1package catalog
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/validation"
25	"github.com/Azure/go-autorest/tracing"
26	"net/http"
27)
28
29// Client is the creates an Azure Data Lake Analytics catalog client.
30type Client struct {
31	BaseClient
32}
33
34// NewClient creates an instance of the Client client.
35func NewClient() Client {
36	return Client{New()}
37}
38
39// CreateSecret creates the specified secret for use with external data sources in the specified database.
40// Parameters:
41// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
42// databaseName - the name of the database in which to create the secret.
43// secretName - the name of the secret.
44// parameters - the parameters required to create the secret (name and password)
45func (client Client) CreateSecret(ctx context.Context, accountName string, databaseName string, secretName string, parameters DataLakeAnalyticsCatalogSecretCreateOrUpdateParameters) (result USQLSecret, err error) {
46	if tracing.IsEnabled() {
47		ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateSecret")
48		defer func() {
49			sc := -1
50			if result.Response.Response != nil {
51				sc = result.Response.Response.StatusCode
52			}
53			tracing.EndSpan(ctx, sc, err)
54		}()
55	}
56	if err := validation.Validate([]validation.Validation{
57		{TargetValue: parameters,
58			Constraints: []validation.Constraint{{Target: "parameters.Password", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
59		return result, validation.NewError("catalog.Client", "CreateSecret", err.Error())
60	}
61
62	req, err := client.CreateSecretPreparer(ctx, accountName, databaseName, secretName, parameters)
63	if err != nil {
64		err = autorest.NewErrorWithError(err, "catalog.Client", "CreateSecret", nil, "Failure preparing request")
65		return
66	}
67
68	resp, err := client.CreateSecretSender(req)
69	if err != nil {
70		result.Response = autorest.Response{Response: resp}
71		err = autorest.NewErrorWithError(err, "catalog.Client", "CreateSecret", resp, "Failure sending request")
72		return
73	}
74
75	result, err = client.CreateSecretResponder(resp)
76	if err != nil {
77		err = autorest.NewErrorWithError(err, "catalog.Client", "CreateSecret", resp, "Failure responding to request")
78	}
79
80	return
81}
82
83// CreateSecretPreparer prepares the CreateSecret request.
84func (client Client) CreateSecretPreparer(ctx context.Context, accountName string, databaseName string, secretName string, parameters DataLakeAnalyticsCatalogSecretCreateOrUpdateParameters) (*http.Request, error) {
85	urlParameters := map[string]interface{}{
86		"accountName":          accountName,
87		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
88	}
89
90	pathParameters := map[string]interface{}{
91		"databaseName": autorest.Encode("path", databaseName),
92		"secretName":   autorest.Encode("path", secretName),
93	}
94
95	const APIVersion = "2015-10-01-preview"
96	queryParameters := map[string]interface{}{
97		"api-version": APIVersion,
98	}
99
100	preparer := autorest.CreatePreparer(
101		autorest.AsContentType("application/json; charset=utf-8"),
102		autorest.AsPut(),
103		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
104		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/secrets/{secretName}", pathParameters),
105		autorest.WithJSON(parameters),
106		autorest.WithQueryParameters(queryParameters))
107	return preparer.Prepare((&http.Request{}).WithContext(ctx))
108}
109
110// CreateSecretSender sends the CreateSecret request. The method will close the
111// http.Response Body if it receives an error.
112func (client Client) CreateSecretSender(req *http.Request) (*http.Response, error) {
113	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
114	return autorest.SendWithSender(client, req, sd...)
115}
116
117// CreateSecretResponder handles the response to the CreateSecret request. The method always
118// closes the http.Response Body.
119func (client Client) CreateSecretResponder(resp *http.Response) (result USQLSecret, err error) {
120	err = autorest.Respond(
121		resp,
122		client.ByInspecting(),
123		azure.WithErrorUnlessStatusCode(http.StatusOK),
124		autorest.ByUnmarshallingJSON(&result),
125		autorest.ByClosing())
126	result.Response = autorest.Response{Response: resp}
127	return
128}
129
130// DeleteAllSecrets deletes all secrets in the specified database
131// Parameters:
132// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
133// databaseName - the name of the database containing the secret.
134func (client Client) DeleteAllSecrets(ctx context.Context, accountName string, databaseName string) (result autorest.Response, err error) {
135	if tracing.IsEnabled() {
136		ctx = tracing.StartSpan(ctx, fqdn+"/Client.DeleteAllSecrets")
137		defer func() {
138			sc := -1
139			if result.Response != nil {
140				sc = result.Response.StatusCode
141			}
142			tracing.EndSpan(ctx, sc, err)
143		}()
144	}
145	req, err := client.DeleteAllSecretsPreparer(ctx, accountName, databaseName)
146	if err != nil {
147		err = autorest.NewErrorWithError(err, "catalog.Client", "DeleteAllSecrets", nil, "Failure preparing request")
148		return
149	}
150
151	resp, err := client.DeleteAllSecretsSender(req)
152	if err != nil {
153		result.Response = resp
154		err = autorest.NewErrorWithError(err, "catalog.Client", "DeleteAllSecrets", resp, "Failure sending request")
155		return
156	}
157
158	result, err = client.DeleteAllSecretsResponder(resp)
159	if err != nil {
160		err = autorest.NewErrorWithError(err, "catalog.Client", "DeleteAllSecrets", resp, "Failure responding to request")
161	}
162
163	return
164}
165
166// DeleteAllSecretsPreparer prepares the DeleteAllSecrets request.
167func (client Client) DeleteAllSecretsPreparer(ctx context.Context, accountName string, databaseName string) (*http.Request, error) {
168	urlParameters := map[string]interface{}{
169		"accountName":          accountName,
170		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
171	}
172
173	pathParameters := map[string]interface{}{
174		"databaseName": autorest.Encode("path", databaseName),
175	}
176
177	const APIVersion = "2015-10-01-preview"
178	queryParameters := map[string]interface{}{
179		"api-version": APIVersion,
180	}
181
182	preparer := autorest.CreatePreparer(
183		autorest.AsDelete(),
184		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
185		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/secrets", pathParameters),
186		autorest.WithQueryParameters(queryParameters))
187	return preparer.Prepare((&http.Request{}).WithContext(ctx))
188}
189
190// DeleteAllSecretsSender sends the DeleteAllSecrets request. The method will close the
191// http.Response Body if it receives an error.
192func (client Client) DeleteAllSecretsSender(req *http.Request) (*http.Response, error) {
193	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
194	return autorest.SendWithSender(client, req, sd...)
195}
196
197// DeleteAllSecretsResponder handles the response to the DeleteAllSecrets request. The method always
198// closes the http.Response Body.
199func (client Client) DeleteAllSecretsResponder(resp *http.Response) (result autorest.Response, err error) {
200	err = autorest.Respond(
201		resp,
202		client.ByInspecting(),
203		azure.WithErrorUnlessStatusCode(http.StatusOK),
204		autorest.ByClosing())
205	result.Response = resp
206	return
207}
208
209// DeleteSecret deletes the specified secret in the specified database
210// Parameters:
211// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
212// databaseName - the name of the database containing the secret.
213// secretName - the name of the secret to delete
214func (client Client) DeleteSecret(ctx context.Context, accountName string, databaseName string, secretName string) (result autorest.Response, err error) {
215	if tracing.IsEnabled() {
216		ctx = tracing.StartSpan(ctx, fqdn+"/Client.DeleteSecret")
217		defer func() {
218			sc := -1
219			if result.Response != nil {
220				sc = result.Response.StatusCode
221			}
222			tracing.EndSpan(ctx, sc, err)
223		}()
224	}
225	req, err := client.DeleteSecretPreparer(ctx, accountName, databaseName, secretName)
226	if err != nil {
227		err = autorest.NewErrorWithError(err, "catalog.Client", "DeleteSecret", nil, "Failure preparing request")
228		return
229	}
230
231	resp, err := client.DeleteSecretSender(req)
232	if err != nil {
233		result.Response = resp
234		err = autorest.NewErrorWithError(err, "catalog.Client", "DeleteSecret", resp, "Failure sending request")
235		return
236	}
237
238	result, err = client.DeleteSecretResponder(resp)
239	if err != nil {
240		err = autorest.NewErrorWithError(err, "catalog.Client", "DeleteSecret", resp, "Failure responding to request")
241	}
242
243	return
244}
245
246// DeleteSecretPreparer prepares the DeleteSecret request.
247func (client Client) DeleteSecretPreparer(ctx context.Context, accountName string, databaseName string, secretName string) (*http.Request, error) {
248	urlParameters := map[string]interface{}{
249		"accountName":          accountName,
250		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
251	}
252
253	pathParameters := map[string]interface{}{
254		"databaseName": autorest.Encode("path", databaseName),
255		"secretName":   autorest.Encode("path", secretName),
256	}
257
258	const APIVersion = "2015-10-01-preview"
259	queryParameters := map[string]interface{}{
260		"api-version": APIVersion,
261	}
262
263	preparer := autorest.CreatePreparer(
264		autorest.AsDelete(),
265		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
266		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/secrets/{secretName}", pathParameters),
267		autorest.WithQueryParameters(queryParameters))
268	return preparer.Prepare((&http.Request{}).WithContext(ctx))
269}
270
271// DeleteSecretSender sends the DeleteSecret request. The method will close the
272// http.Response Body if it receives an error.
273func (client Client) DeleteSecretSender(req *http.Request) (*http.Response, error) {
274	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
275	return autorest.SendWithSender(client, req, sd...)
276}
277
278// DeleteSecretResponder handles the response to the DeleteSecret request. The method always
279// closes the http.Response Body.
280func (client Client) DeleteSecretResponder(resp *http.Response) (result autorest.Response, err error) {
281	err = autorest.Respond(
282		resp,
283		client.ByInspecting(),
284		azure.WithErrorUnlessStatusCode(http.StatusOK),
285		autorest.ByClosing())
286	result.Response = resp
287	return
288}
289
290// GetAssembly retrieves the specified assembly from the Data Lake Analytics catalog.
291// Parameters:
292// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
293// databaseName - the name of the database containing the assembly.
294// assemblyName - the name of the assembly.
295func (client Client) GetAssembly(ctx context.Context, accountName string, databaseName string, assemblyName string) (result USQLAssembly, err error) {
296	if tracing.IsEnabled() {
297		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetAssembly")
298		defer func() {
299			sc := -1
300			if result.Response.Response != nil {
301				sc = result.Response.Response.StatusCode
302			}
303			tracing.EndSpan(ctx, sc, err)
304		}()
305	}
306	req, err := client.GetAssemblyPreparer(ctx, accountName, databaseName, assemblyName)
307	if err != nil {
308		err = autorest.NewErrorWithError(err, "catalog.Client", "GetAssembly", nil, "Failure preparing request")
309		return
310	}
311
312	resp, err := client.GetAssemblySender(req)
313	if err != nil {
314		result.Response = autorest.Response{Response: resp}
315		err = autorest.NewErrorWithError(err, "catalog.Client", "GetAssembly", resp, "Failure sending request")
316		return
317	}
318
319	result, err = client.GetAssemblyResponder(resp)
320	if err != nil {
321		err = autorest.NewErrorWithError(err, "catalog.Client", "GetAssembly", resp, "Failure responding to request")
322	}
323
324	return
325}
326
327// GetAssemblyPreparer prepares the GetAssembly request.
328func (client Client) GetAssemblyPreparer(ctx context.Context, accountName string, databaseName string, assemblyName string) (*http.Request, error) {
329	urlParameters := map[string]interface{}{
330		"accountName":          accountName,
331		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
332	}
333
334	pathParameters := map[string]interface{}{
335		"assemblyName": autorest.Encode("path", assemblyName),
336		"databaseName": autorest.Encode("path", databaseName),
337	}
338
339	const APIVersion = "2015-10-01-preview"
340	queryParameters := map[string]interface{}{
341		"api-version": APIVersion,
342	}
343
344	preparer := autorest.CreatePreparer(
345		autorest.AsGet(),
346		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
347		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/assemblies/{assemblyName}", pathParameters),
348		autorest.WithQueryParameters(queryParameters))
349	return preparer.Prepare((&http.Request{}).WithContext(ctx))
350}
351
352// GetAssemblySender sends the GetAssembly request. The method will close the
353// http.Response Body if it receives an error.
354func (client Client) GetAssemblySender(req *http.Request) (*http.Response, error) {
355	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
356	return autorest.SendWithSender(client, req, sd...)
357}
358
359// GetAssemblyResponder handles the response to the GetAssembly request. The method always
360// closes the http.Response Body.
361func (client Client) GetAssemblyResponder(resp *http.Response) (result USQLAssembly, err error) {
362	err = autorest.Respond(
363		resp,
364		client.ByInspecting(),
365		azure.WithErrorUnlessStatusCode(http.StatusOK),
366		autorest.ByUnmarshallingJSON(&result),
367		autorest.ByClosing())
368	result.Response = autorest.Response{Response: resp}
369	return
370}
371
372// GetCredential retrieves the specified credential from the Data Lake Analytics catalog.
373// Parameters:
374// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
375// databaseName - the name of the database containing the schema.
376// credentialName - the name of the credential.
377func (client Client) GetCredential(ctx context.Context, accountName string, databaseName string, credentialName string) (result USQLCredential, err error) {
378	if tracing.IsEnabled() {
379		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetCredential")
380		defer func() {
381			sc := -1
382			if result.Response.Response != nil {
383				sc = result.Response.Response.StatusCode
384			}
385			tracing.EndSpan(ctx, sc, err)
386		}()
387	}
388	req, err := client.GetCredentialPreparer(ctx, accountName, databaseName, credentialName)
389	if err != nil {
390		err = autorest.NewErrorWithError(err, "catalog.Client", "GetCredential", nil, "Failure preparing request")
391		return
392	}
393
394	resp, err := client.GetCredentialSender(req)
395	if err != nil {
396		result.Response = autorest.Response{Response: resp}
397		err = autorest.NewErrorWithError(err, "catalog.Client", "GetCredential", resp, "Failure sending request")
398		return
399	}
400
401	result, err = client.GetCredentialResponder(resp)
402	if err != nil {
403		err = autorest.NewErrorWithError(err, "catalog.Client", "GetCredential", resp, "Failure responding to request")
404	}
405
406	return
407}
408
409// GetCredentialPreparer prepares the GetCredential request.
410func (client Client) GetCredentialPreparer(ctx context.Context, accountName string, databaseName string, credentialName string) (*http.Request, error) {
411	urlParameters := map[string]interface{}{
412		"accountName":          accountName,
413		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
414	}
415
416	pathParameters := map[string]interface{}{
417		"credentialName": autorest.Encode("path", credentialName),
418		"databaseName":   autorest.Encode("path", databaseName),
419	}
420
421	const APIVersion = "2015-10-01-preview"
422	queryParameters := map[string]interface{}{
423		"api-version": APIVersion,
424	}
425
426	preparer := autorest.CreatePreparer(
427		autorest.AsGet(),
428		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
429		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/credentials/{credentialName}", pathParameters),
430		autorest.WithQueryParameters(queryParameters))
431	return preparer.Prepare((&http.Request{}).WithContext(ctx))
432}
433
434// GetCredentialSender sends the GetCredential request. The method will close the
435// http.Response Body if it receives an error.
436func (client Client) GetCredentialSender(req *http.Request) (*http.Response, error) {
437	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
438	return autorest.SendWithSender(client, req, sd...)
439}
440
441// GetCredentialResponder handles the response to the GetCredential request. The method always
442// closes the http.Response Body.
443func (client Client) GetCredentialResponder(resp *http.Response) (result USQLCredential, err error) {
444	err = autorest.Respond(
445		resp,
446		client.ByInspecting(),
447		azure.WithErrorUnlessStatusCode(http.StatusOK),
448		autorest.ByUnmarshallingJSON(&result),
449		autorest.ByClosing())
450	result.Response = autorest.Response{Response: resp}
451	return
452}
453
454// GetDatabase retrieves the specified database from the Data Lake Analytics catalog.
455// Parameters:
456// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
457// databaseName - the name of the database.
458func (client Client) GetDatabase(ctx context.Context, accountName string, databaseName string) (result USQLDatabase, err error) {
459	if tracing.IsEnabled() {
460		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetDatabase")
461		defer func() {
462			sc := -1
463			if result.Response.Response != nil {
464				sc = result.Response.Response.StatusCode
465			}
466			tracing.EndSpan(ctx, sc, err)
467		}()
468	}
469	req, err := client.GetDatabasePreparer(ctx, accountName, databaseName)
470	if err != nil {
471		err = autorest.NewErrorWithError(err, "catalog.Client", "GetDatabase", nil, "Failure preparing request")
472		return
473	}
474
475	resp, err := client.GetDatabaseSender(req)
476	if err != nil {
477		result.Response = autorest.Response{Response: resp}
478		err = autorest.NewErrorWithError(err, "catalog.Client", "GetDatabase", resp, "Failure sending request")
479		return
480	}
481
482	result, err = client.GetDatabaseResponder(resp)
483	if err != nil {
484		err = autorest.NewErrorWithError(err, "catalog.Client", "GetDatabase", resp, "Failure responding to request")
485	}
486
487	return
488}
489
490// GetDatabasePreparer prepares the GetDatabase request.
491func (client Client) GetDatabasePreparer(ctx context.Context, accountName string, databaseName string) (*http.Request, error) {
492	urlParameters := map[string]interface{}{
493		"accountName":          accountName,
494		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
495	}
496
497	pathParameters := map[string]interface{}{
498		"databaseName": autorest.Encode("path", databaseName),
499	}
500
501	const APIVersion = "2015-10-01-preview"
502	queryParameters := map[string]interface{}{
503		"api-version": APIVersion,
504	}
505
506	preparer := autorest.CreatePreparer(
507		autorest.AsGet(),
508		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
509		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}", pathParameters),
510		autorest.WithQueryParameters(queryParameters))
511	return preparer.Prepare((&http.Request{}).WithContext(ctx))
512}
513
514// GetDatabaseSender sends the GetDatabase request. The method will close the
515// http.Response Body if it receives an error.
516func (client Client) GetDatabaseSender(req *http.Request) (*http.Response, error) {
517	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
518	return autorest.SendWithSender(client, req, sd...)
519}
520
521// GetDatabaseResponder handles the response to the GetDatabase request. The method always
522// closes the http.Response Body.
523func (client Client) GetDatabaseResponder(resp *http.Response) (result USQLDatabase, err error) {
524	err = autorest.Respond(
525		resp,
526		client.ByInspecting(),
527		azure.WithErrorUnlessStatusCode(http.StatusOK),
528		autorest.ByUnmarshallingJSON(&result),
529		autorest.ByClosing())
530	result.Response = autorest.Response{Response: resp}
531	return
532}
533
534// GetExternalDataSource retrieves the specified external data source from the Data Lake Analytics catalog.
535// Parameters:
536// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
537// databaseName - the name of the database containing the external data source.
538// externalDataSourceName - the name of the external data source.
539func (client Client) GetExternalDataSource(ctx context.Context, accountName string, databaseName string, externalDataSourceName string) (result USQLExternalDataSource, err error) {
540	if tracing.IsEnabled() {
541		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetExternalDataSource")
542		defer func() {
543			sc := -1
544			if result.Response.Response != nil {
545				sc = result.Response.Response.StatusCode
546			}
547			tracing.EndSpan(ctx, sc, err)
548		}()
549	}
550	req, err := client.GetExternalDataSourcePreparer(ctx, accountName, databaseName, externalDataSourceName)
551	if err != nil {
552		err = autorest.NewErrorWithError(err, "catalog.Client", "GetExternalDataSource", nil, "Failure preparing request")
553		return
554	}
555
556	resp, err := client.GetExternalDataSourceSender(req)
557	if err != nil {
558		result.Response = autorest.Response{Response: resp}
559		err = autorest.NewErrorWithError(err, "catalog.Client", "GetExternalDataSource", resp, "Failure sending request")
560		return
561	}
562
563	result, err = client.GetExternalDataSourceResponder(resp)
564	if err != nil {
565		err = autorest.NewErrorWithError(err, "catalog.Client", "GetExternalDataSource", resp, "Failure responding to request")
566	}
567
568	return
569}
570
571// GetExternalDataSourcePreparer prepares the GetExternalDataSource request.
572func (client Client) GetExternalDataSourcePreparer(ctx context.Context, accountName string, databaseName string, externalDataSourceName string) (*http.Request, error) {
573	urlParameters := map[string]interface{}{
574		"accountName":          accountName,
575		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
576	}
577
578	pathParameters := map[string]interface{}{
579		"databaseName":           autorest.Encode("path", databaseName),
580		"externalDataSourceName": autorest.Encode("path", externalDataSourceName),
581	}
582
583	const APIVersion = "2015-10-01-preview"
584	queryParameters := map[string]interface{}{
585		"api-version": APIVersion,
586	}
587
588	preparer := autorest.CreatePreparer(
589		autorest.AsGet(),
590		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
591		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/externaldatasources/{externalDataSourceName}", pathParameters),
592		autorest.WithQueryParameters(queryParameters))
593	return preparer.Prepare((&http.Request{}).WithContext(ctx))
594}
595
596// GetExternalDataSourceSender sends the GetExternalDataSource request. The method will close the
597// http.Response Body if it receives an error.
598func (client Client) GetExternalDataSourceSender(req *http.Request) (*http.Response, error) {
599	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
600	return autorest.SendWithSender(client, req, sd...)
601}
602
603// GetExternalDataSourceResponder handles the response to the GetExternalDataSource request. The method always
604// closes the http.Response Body.
605func (client Client) GetExternalDataSourceResponder(resp *http.Response) (result USQLExternalDataSource, err error) {
606	err = autorest.Respond(
607		resp,
608		client.ByInspecting(),
609		azure.WithErrorUnlessStatusCode(http.StatusOK),
610		autorest.ByUnmarshallingJSON(&result),
611		autorest.ByClosing())
612	result.Response = autorest.Response{Response: resp}
613	return
614}
615
616// GetProcedure retrieves the specified procedure from the Data Lake Analytics catalog.
617// Parameters:
618// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
619// databaseName - the name of the database containing the procedure.
620// schemaName - the name of the schema containing the procedure.
621// procedureName - the name of the procedure.
622func (client Client) GetProcedure(ctx context.Context, accountName string, databaseName string, schemaName string, procedureName string) (result USQLProcedure, err error) {
623	if tracing.IsEnabled() {
624		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetProcedure")
625		defer func() {
626			sc := -1
627			if result.Response.Response != nil {
628				sc = result.Response.Response.StatusCode
629			}
630			tracing.EndSpan(ctx, sc, err)
631		}()
632	}
633	req, err := client.GetProcedurePreparer(ctx, accountName, databaseName, schemaName, procedureName)
634	if err != nil {
635		err = autorest.NewErrorWithError(err, "catalog.Client", "GetProcedure", nil, "Failure preparing request")
636		return
637	}
638
639	resp, err := client.GetProcedureSender(req)
640	if err != nil {
641		result.Response = autorest.Response{Response: resp}
642		err = autorest.NewErrorWithError(err, "catalog.Client", "GetProcedure", resp, "Failure sending request")
643		return
644	}
645
646	result, err = client.GetProcedureResponder(resp)
647	if err != nil {
648		err = autorest.NewErrorWithError(err, "catalog.Client", "GetProcedure", resp, "Failure responding to request")
649	}
650
651	return
652}
653
654// GetProcedurePreparer prepares the GetProcedure request.
655func (client Client) GetProcedurePreparer(ctx context.Context, accountName string, databaseName string, schemaName string, procedureName string) (*http.Request, error) {
656	urlParameters := map[string]interface{}{
657		"accountName":          accountName,
658		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
659	}
660
661	pathParameters := map[string]interface{}{
662		"databaseName":  autorest.Encode("path", databaseName),
663		"procedureName": autorest.Encode("path", procedureName),
664		"schemaName":    autorest.Encode("path", schemaName),
665	}
666
667	const APIVersion = "2015-10-01-preview"
668	queryParameters := map[string]interface{}{
669		"api-version": APIVersion,
670	}
671
672	preparer := autorest.CreatePreparer(
673		autorest.AsGet(),
674		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
675		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/procedures/{procedureName}", pathParameters),
676		autorest.WithQueryParameters(queryParameters))
677	return preparer.Prepare((&http.Request{}).WithContext(ctx))
678}
679
680// GetProcedureSender sends the GetProcedure request. The method will close the
681// http.Response Body if it receives an error.
682func (client Client) GetProcedureSender(req *http.Request) (*http.Response, error) {
683	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
684	return autorest.SendWithSender(client, req, sd...)
685}
686
687// GetProcedureResponder handles the response to the GetProcedure request. The method always
688// closes the http.Response Body.
689func (client Client) GetProcedureResponder(resp *http.Response) (result USQLProcedure, err error) {
690	err = autorest.Respond(
691		resp,
692		client.ByInspecting(),
693		azure.WithErrorUnlessStatusCode(http.StatusOK),
694		autorest.ByUnmarshallingJSON(&result),
695		autorest.ByClosing())
696	result.Response = autorest.Response{Response: resp}
697	return
698}
699
700// GetSchema retrieves the specified schema from the Data Lake Analytics catalog.
701// Parameters:
702// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
703// databaseName - the name of the database containing the schema.
704// schemaName - the name of the schema.
705func (client Client) GetSchema(ctx context.Context, accountName string, databaseName string, schemaName string) (result USQLSchema, err error) {
706	if tracing.IsEnabled() {
707		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetSchema")
708		defer func() {
709			sc := -1
710			if result.Response.Response != nil {
711				sc = result.Response.Response.StatusCode
712			}
713			tracing.EndSpan(ctx, sc, err)
714		}()
715	}
716	req, err := client.GetSchemaPreparer(ctx, accountName, databaseName, schemaName)
717	if err != nil {
718		err = autorest.NewErrorWithError(err, "catalog.Client", "GetSchema", nil, "Failure preparing request")
719		return
720	}
721
722	resp, err := client.GetSchemaSender(req)
723	if err != nil {
724		result.Response = autorest.Response{Response: resp}
725		err = autorest.NewErrorWithError(err, "catalog.Client", "GetSchema", resp, "Failure sending request")
726		return
727	}
728
729	result, err = client.GetSchemaResponder(resp)
730	if err != nil {
731		err = autorest.NewErrorWithError(err, "catalog.Client", "GetSchema", resp, "Failure responding to request")
732	}
733
734	return
735}
736
737// GetSchemaPreparer prepares the GetSchema request.
738func (client Client) GetSchemaPreparer(ctx context.Context, accountName string, databaseName string, schemaName string) (*http.Request, error) {
739	urlParameters := map[string]interface{}{
740		"accountName":          accountName,
741		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
742	}
743
744	pathParameters := map[string]interface{}{
745		"databaseName": autorest.Encode("path", databaseName),
746		"schemaName":   autorest.Encode("path", schemaName),
747	}
748
749	const APIVersion = "2015-10-01-preview"
750	queryParameters := map[string]interface{}{
751		"api-version": APIVersion,
752	}
753
754	preparer := autorest.CreatePreparer(
755		autorest.AsGet(),
756		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
757		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}", pathParameters),
758		autorest.WithQueryParameters(queryParameters))
759	return preparer.Prepare((&http.Request{}).WithContext(ctx))
760}
761
762// GetSchemaSender sends the GetSchema request. The method will close the
763// http.Response Body if it receives an error.
764func (client Client) GetSchemaSender(req *http.Request) (*http.Response, error) {
765	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
766	return autorest.SendWithSender(client, req, sd...)
767}
768
769// GetSchemaResponder handles the response to the GetSchema request. The method always
770// closes the http.Response Body.
771func (client Client) GetSchemaResponder(resp *http.Response) (result USQLSchema, err error) {
772	err = autorest.Respond(
773		resp,
774		client.ByInspecting(),
775		azure.WithErrorUnlessStatusCode(http.StatusOK),
776		autorest.ByUnmarshallingJSON(&result),
777		autorest.ByClosing())
778	result.Response = autorest.Response{Response: resp}
779	return
780}
781
782// GetSecret gets the specified secret in the specified database
783// Parameters:
784// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
785// databaseName - the name of the database containing the secret.
786// secretName - the name of the secret to get
787func (client Client) GetSecret(ctx context.Context, accountName string, databaseName string, secretName string) (result USQLSecret, err error) {
788	if tracing.IsEnabled() {
789		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetSecret")
790		defer func() {
791			sc := -1
792			if result.Response.Response != nil {
793				sc = result.Response.Response.StatusCode
794			}
795			tracing.EndSpan(ctx, sc, err)
796		}()
797	}
798	req, err := client.GetSecretPreparer(ctx, accountName, databaseName, secretName)
799	if err != nil {
800		err = autorest.NewErrorWithError(err, "catalog.Client", "GetSecret", nil, "Failure preparing request")
801		return
802	}
803
804	resp, err := client.GetSecretSender(req)
805	if err != nil {
806		result.Response = autorest.Response{Response: resp}
807		err = autorest.NewErrorWithError(err, "catalog.Client", "GetSecret", resp, "Failure sending request")
808		return
809	}
810
811	result, err = client.GetSecretResponder(resp)
812	if err != nil {
813		err = autorest.NewErrorWithError(err, "catalog.Client", "GetSecret", resp, "Failure responding to request")
814	}
815
816	return
817}
818
819// GetSecretPreparer prepares the GetSecret request.
820func (client Client) GetSecretPreparer(ctx context.Context, accountName string, databaseName string, secretName string) (*http.Request, error) {
821	urlParameters := map[string]interface{}{
822		"accountName":          accountName,
823		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
824	}
825
826	pathParameters := map[string]interface{}{
827		"databaseName": autorest.Encode("path", databaseName),
828		"secretName":   autorest.Encode("path", secretName),
829	}
830
831	const APIVersion = "2015-10-01-preview"
832	queryParameters := map[string]interface{}{
833		"api-version": APIVersion,
834	}
835
836	preparer := autorest.CreatePreparer(
837		autorest.AsGet(),
838		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
839		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/secrets/{secretName}", pathParameters),
840		autorest.WithQueryParameters(queryParameters))
841	return preparer.Prepare((&http.Request{}).WithContext(ctx))
842}
843
844// GetSecretSender sends the GetSecret request. The method will close the
845// http.Response Body if it receives an error.
846func (client Client) GetSecretSender(req *http.Request) (*http.Response, error) {
847	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
848	return autorest.SendWithSender(client, req, sd...)
849}
850
851// GetSecretResponder handles the response to the GetSecret request. The method always
852// closes the http.Response Body.
853func (client Client) GetSecretResponder(resp *http.Response) (result USQLSecret, err error) {
854	err = autorest.Respond(
855		resp,
856		client.ByInspecting(),
857		azure.WithErrorUnlessStatusCode(http.StatusOK),
858		autorest.ByUnmarshallingJSON(&result),
859		autorest.ByClosing())
860	result.Response = autorest.Response{Response: resp}
861	return
862}
863
864// GetTable retrieves the specified table from the Data Lake Analytics catalog.
865// Parameters:
866// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
867// databaseName - the name of the database containing the table.
868// schemaName - the name of the schema containing the table.
869// tableName - the name of the table.
870func (client Client) GetTable(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string) (result USQLTable, err error) {
871	if tracing.IsEnabled() {
872		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetTable")
873		defer func() {
874			sc := -1
875			if result.Response.Response != nil {
876				sc = result.Response.Response.StatusCode
877			}
878			tracing.EndSpan(ctx, sc, err)
879		}()
880	}
881	req, err := client.GetTablePreparer(ctx, accountName, databaseName, schemaName, tableName)
882	if err != nil {
883		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTable", nil, "Failure preparing request")
884		return
885	}
886
887	resp, err := client.GetTableSender(req)
888	if err != nil {
889		result.Response = autorest.Response{Response: resp}
890		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTable", resp, "Failure sending request")
891		return
892	}
893
894	result, err = client.GetTableResponder(resp)
895	if err != nil {
896		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTable", resp, "Failure responding to request")
897	}
898
899	return
900}
901
902// GetTablePreparer prepares the GetTable request.
903func (client Client) GetTablePreparer(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string) (*http.Request, error) {
904	urlParameters := map[string]interface{}{
905		"accountName":          accountName,
906		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
907	}
908
909	pathParameters := map[string]interface{}{
910		"databaseName": autorest.Encode("path", databaseName),
911		"schemaName":   autorest.Encode("path", schemaName),
912		"tableName":    autorest.Encode("path", tableName),
913	}
914
915	const APIVersion = "2015-10-01-preview"
916	queryParameters := map[string]interface{}{
917		"api-version": APIVersion,
918	}
919
920	preparer := autorest.CreatePreparer(
921		autorest.AsGet(),
922		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
923		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}", pathParameters),
924		autorest.WithQueryParameters(queryParameters))
925	return preparer.Prepare((&http.Request{}).WithContext(ctx))
926}
927
928// GetTableSender sends the GetTable request. The method will close the
929// http.Response Body if it receives an error.
930func (client Client) GetTableSender(req *http.Request) (*http.Response, error) {
931	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
932	return autorest.SendWithSender(client, req, sd...)
933}
934
935// GetTableResponder handles the response to the GetTable request. The method always
936// closes the http.Response Body.
937func (client Client) GetTableResponder(resp *http.Response) (result USQLTable, err error) {
938	err = autorest.Respond(
939		resp,
940		client.ByInspecting(),
941		azure.WithErrorUnlessStatusCode(http.StatusOK),
942		autorest.ByUnmarshallingJSON(&result),
943		autorest.ByClosing())
944	result.Response = autorest.Response{Response: resp}
945	return
946}
947
948// GetTablePartition retrieves the specified table partition from the Data Lake Analytics catalog.
949// Parameters:
950// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
951// databaseName - the name of the database containing the partition.
952// schemaName - the name of the schema containing the partition.
953// tableName - the name of the table containing the partition.
954// partitionName - the name of the table partition.
955func (client Client) GetTablePartition(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string, partitionName string) (result USQLTablePartition, err error) {
956	if tracing.IsEnabled() {
957		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetTablePartition")
958		defer func() {
959			sc := -1
960			if result.Response.Response != nil {
961				sc = result.Response.Response.StatusCode
962			}
963			tracing.EndSpan(ctx, sc, err)
964		}()
965	}
966	req, err := client.GetTablePartitionPreparer(ctx, accountName, databaseName, schemaName, tableName, partitionName)
967	if err != nil {
968		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTablePartition", nil, "Failure preparing request")
969		return
970	}
971
972	resp, err := client.GetTablePartitionSender(req)
973	if err != nil {
974		result.Response = autorest.Response{Response: resp}
975		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTablePartition", resp, "Failure sending request")
976		return
977	}
978
979	result, err = client.GetTablePartitionResponder(resp)
980	if err != nil {
981		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTablePartition", resp, "Failure responding to request")
982	}
983
984	return
985}
986
987// GetTablePartitionPreparer prepares the GetTablePartition request.
988func (client Client) GetTablePartitionPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string, partitionName string) (*http.Request, error) {
989	urlParameters := map[string]interface{}{
990		"accountName":          accountName,
991		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
992	}
993
994	pathParameters := map[string]interface{}{
995		"databaseName":  autorest.Encode("path", databaseName),
996		"partitionName": autorest.Encode("path", partitionName),
997		"schemaName":    autorest.Encode("path", schemaName),
998		"tableName":     autorest.Encode("path", tableName),
999	}
1000
1001	const APIVersion = "2015-10-01-preview"
1002	queryParameters := map[string]interface{}{
1003		"api-version": APIVersion,
1004	}
1005
1006	preparer := autorest.CreatePreparer(
1007		autorest.AsGet(),
1008		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
1009		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partitions/{partitionName}", pathParameters),
1010		autorest.WithQueryParameters(queryParameters))
1011	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1012}
1013
1014// GetTablePartitionSender sends the GetTablePartition request. The method will close the
1015// http.Response Body if it receives an error.
1016func (client Client) GetTablePartitionSender(req *http.Request) (*http.Response, error) {
1017	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1018	return autorest.SendWithSender(client, req, sd...)
1019}
1020
1021// GetTablePartitionResponder handles the response to the GetTablePartition request. The method always
1022// closes the http.Response Body.
1023func (client Client) GetTablePartitionResponder(resp *http.Response) (result USQLTablePartition, err error) {
1024	err = autorest.Respond(
1025		resp,
1026		client.ByInspecting(),
1027		azure.WithErrorUnlessStatusCode(http.StatusOK),
1028		autorest.ByUnmarshallingJSON(&result),
1029		autorest.ByClosing())
1030	result.Response = autorest.Response{Response: resp}
1031	return
1032}
1033
1034// GetTableStatistic retrieves the specified table statistics from the Data Lake Analytics catalog.
1035// Parameters:
1036// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
1037// databaseName - the name of the database containing the statistics.
1038// schemaName - the name of the schema containing the statistics.
1039// tableName - the name of the table containing the statistics.
1040// statisticsName - the name of the table statistics.
1041func (client Client) GetTableStatistic(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string, statisticsName string) (result USQLTableStatistics, err error) {
1042	if tracing.IsEnabled() {
1043		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetTableStatistic")
1044		defer func() {
1045			sc := -1
1046			if result.Response.Response != nil {
1047				sc = result.Response.Response.StatusCode
1048			}
1049			tracing.EndSpan(ctx, sc, err)
1050		}()
1051	}
1052	req, err := client.GetTableStatisticPreparer(ctx, accountName, databaseName, schemaName, tableName, statisticsName)
1053	if err != nil {
1054		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTableStatistic", nil, "Failure preparing request")
1055		return
1056	}
1057
1058	resp, err := client.GetTableStatisticSender(req)
1059	if err != nil {
1060		result.Response = autorest.Response{Response: resp}
1061		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTableStatistic", resp, "Failure sending request")
1062		return
1063	}
1064
1065	result, err = client.GetTableStatisticResponder(resp)
1066	if err != nil {
1067		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTableStatistic", resp, "Failure responding to request")
1068	}
1069
1070	return
1071}
1072
1073// GetTableStatisticPreparer prepares the GetTableStatistic request.
1074func (client Client) GetTableStatisticPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string, statisticsName string) (*http.Request, error) {
1075	urlParameters := map[string]interface{}{
1076		"accountName":          accountName,
1077		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
1078	}
1079
1080	pathParameters := map[string]interface{}{
1081		"databaseName":   autorest.Encode("path", databaseName),
1082		"schemaName":     autorest.Encode("path", schemaName),
1083		"statisticsName": autorest.Encode("path", statisticsName),
1084		"tableName":      autorest.Encode("path", tableName),
1085	}
1086
1087	const APIVersion = "2015-10-01-preview"
1088	queryParameters := map[string]interface{}{
1089		"api-version": APIVersion,
1090	}
1091
1092	preparer := autorest.CreatePreparer(
1093		autorest.AsGet(),
1094		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
1095		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/statistics/{statisticsName}", pathParameters),
1096		autorest.WithQueryParameters(queryParameters))
1097	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1098}
1099
1100// GetTableStatisticSender sends the GetTableStatistic request. The method will close the
1101// http.Response Body if it receives an error.
1102func (client Client) GetTableStatisticSender(req *http.Request) (*http.Response, error) {
1103	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1104	return autorest.SendWithSender(client, req, sd...)
1105}
1106
1107// GetTableStatisticResponder handles the response to the GetTableStatistic request. The method always
1108// closes the http.Response Body.
1109func (client Client) GetTableStatisticResponder(resp *http.Response) (result USQLTableStatistics, err error) {
1110	err = autorest.Respond(
1111		resp,
1112		client.ByInspecting(),
1113		azure.WithErrorUnlessStatusCode(http.StatusOK),
1114		autorest.ByUnmarshallingJSON(&result),
1115		autorest.ByClosing())
1116	result.Response = autorest.Response{Response: resp}
1117	return
1118}
1119
1120// GetTableType retrieves the specified table type from the Data Lake Analytics catalog.
1121// Parameters:
1122// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
1123// databaseName - the name of the database containing the table type.
1124// schemaName - the name of the schema containing the table type.
1125// tableTypeName - the name of the table type to retrieve.
1126func (client Client) GetTableType(ctx context.Context, accountName string, databaseName string, schemaName string, tableTypeName string) (result USQLTableType, err error) {
1127	if tracing.IsEnabled() {
1128		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetTableType")
1129		defer func() {
1130			sc := -1
1131			if result.Response.Response != nil {
1132				sc = result.Response.Response.StatusCode
1133			}
1134			tracing.EndSpan(ctx, sc, err)
1135		}()
1136	}
1137	req, err := client.GetTableTypePreparer(ctx, accountName, databaseName, schemaName, tableTypeName)
1138	if err != nil {
1139		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTableType", nil, "Failure preparing request")
1140		return
1141	}
1142
1143	resp, err := client.GetTableTypeSender(req)
1144	if err != nil {
1145		result.Response = autorest.Response{Response: resp}
1146		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTableType", resp, "Failure sending request")
1147		return
1148	}
1149
1150	result, err = client.GetTableTypeResponder(resp)
1151	if err != nil {
1152		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTableType", resp, "Failure responding to request")
1153	}
1154
1155	return
1156}
1157
1158// GetTableTypePreparer prepares the GetTableType request.
1159func (client Client) GetTableTypePreparer(ctx context.Context, accountName string, databaseName string, schemaName string, tableTypeName string) (*http.Request, error) {
1160	urlParameters := map[string]interface{}{
1161		"accountName":          accountName,
1162		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
1163	}
1164
1165	pathParameters := map[string]interface{}{
1166		"databaseName":  autorest.Encode("path", databaseName),
1167		"schemaName":    autorest.Encode("path", schemaName),
1168		"tableTypeName": autorest.Encode("path", tableTypeName),
1169	}
1170
1171	const APIVersion = "2015-10-01-preview"
1172	queryParameters := map[string]interface{}{
1173		"api-version": APIVersion,
1174	}
1175
1176	preparer := autorest.CreatePreparer(
1177		autorest.AsGet(),
1178		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
1179		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/tabletypes/{tableTypeName}", pathParameters),
1180		autorest.WithQueryParameters(queryParameters))
1181	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1182}
1183
1184// GetTableTypeSender sends the GetTableType request. The method will close the
1185// http.Response Body if it receives an error.
1186func (client Client) GetTableTypeSender(req *http.Request) (*http.Response, error) {
1187	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1188	return autorest.SendWithSender(client, req, sd...)
1189}
1190
1191// GetTableTypeResponder handles the response to the GetTableType request. The method always
1192// closes the http.Response Body.
1193func (client Client) GetTableTypeResponder(resp *http.Response) (result USQLTableType, err error) {
1194	err = autorest.Respond(
1195		resp,
1196		client.ByInspecting(),
1197		azure.WithErrorUnlessStatusCode(http.StatusOK),
1198		autorest.ByUnmarshallingJSON(&result),
1199		autorest.ByClosing())
1200	result.Response = autorest.Response{Response: resp}
1201	return
1202}
1203
1204// GetTableValuedFunction retrieves the specified table valued function from the Data Lake Analytics catalog.
1205// Parameters:
1206// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
1207// databaseName - the name of the database containing the table valued function.
1208// schemaName - the name of the schema containing the table valued function.
1209// tableValuedFunctionName - the name of the tableValuedFunction.
1210func (client Client) GetTableValuedFunction(ctx context.Context, accountName string, databaseName string, schemaName string, tableValuedFunctionName string) (result USQLTableValuedFunction, err error) {
1211	if tracing.IsEnabled() {
1212		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetTableValuedFunction")
1213		defer func() {
1214			sc := -1
1215			if result.Response.Response != nil {
1216				sc = result.Response.Response.StatusCode
1217			}
1218			tracing.EndSpan(ctx, sc, err)
1219		}()
1220	}
1221	req, err := client.GetTableValuedFunctionPreparer(ctx, accountName, databaseName, schemaName, tableValuedFunctionName)
1222	if err != nil {
1223		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTableValuedFunction", nil, "Failure preparing request")
1224		return
1225	}
1226
1227	resp, err := client.GetTableValuedFunctionSender(req)
1228	if err != nil {
1229		result.Response = autorest.Response{Response: resp}
1230		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTableValuedFunction", resp, "Failure sending request")
1231		return
1232	}
1233
1234	result, err = client.GetTableValuedFunctionResponder(resp)
1235	if err != nil {
1236		err = autorest.NewErrorWithError(err, "catalog.Client", "GetTableValuedFunction", resp, "Failure responding to request")
1237	}
1238
1239	return
1240}
1241
1242// GetTableValuedFunctionPreparer prepares the GetTableValuedFunction request.
1243func (client Client) GetTableValuedFunctionPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, tableValuedFunctionName string) (*http.Request, error) {
1244	urlParameters := map[string]interface{}{
1245		"accountName":          accountName,
1246		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
1247	}
1248
1249	pathParameters := map[string]interface{}{
1250		"databaseName":            autorest.Encode("path", databaseName),
1251		"schemaName":              autorest.Encode("path", schemaName),
1252		"tableValuedFunctionName": autorest.Encode("path", tableValuedFunctionName),
1253	}
1254
1255	const APIVersion = "2015-10-01-preview"
1256	queryParameters := map[string]interface{}{
1257		"api-version": APIVersion,
1258	}
1259
1260	preparer := autorest.CreatePreparer(
1261		autorest.AsGet(),
1262		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
1263		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/tablevaluedfunctions/{tableValuedFunctionName}", pathParameters),
1264		autorest.WithQueryParameters(queryParameters))
1265	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1266}
1267
1268// GetTableValuedFunctionSender sends the GetTableValuedFunction request. The method will close the
1269// http.Response Body if it receives an error.
1270func (client Client) GetTableValuedFunctionSender(req *http.Request) (*http.Response, error) {
1271	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1272	return autorest.SendWithSender(client, req, sd...)
1273}
1274
1275// GetTableValuedFunctionResponder handles the response to the GetTableValuedFunction request. The method always
1276// closes the http.Response Body.
1277func (client Client) GetTableValuedFunctionResponder(resp *http.Response) (result USQLTableValuedFunction, err error) {
1278	err = autorest.Respond(
1279		resp,
1280		client.ByInspecting(),
1281		azure.WithErrorUnlessStatusCode(http.StatusOK),
1282		autorest.ByUnmarshallingJSON(&result),
1283		autorest.ByClosing())
1284	result.Response = autorest.Response{Response: resp}
1285	return
1286}
1287
1288// GetView retrieves the specified view from the Data Lake Analytics catalog.
1289// Parameters:
1290// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
1291// databaseName - the name of the database containing the view.
1292// schemaName - the name of the schema containing the view.
1293// viewName - the name of the view.
1294func (client Client) GetView(ctx context.Context, accountName string, databaseName string, schemaName string, viewName string) (result USQLView, err error) {
1295	if tracing.IsEnabled() {
1296		ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetView")
1297		defer func() {
1298			sc := -1
1299			if result.Response.Response != nil {
1300				sc = result.Response.Response.StatusCode
1301			}
1302			tracing.EndSpan(ctx, sc, err)
1303		}()
1304	}
1305	req, err := client.GetViewPreparer(ctx, accountName, databaseName, schemaName, viewName)
1306	if err != nil {
1307		err = autorest.NewErrorWithError(err, "catalog.Client", "GetView", nil, "Failure preparing request")
1308		return
1309	}
1310
1311	resp, err := client.GetViewSender(req)
1312	if err != nil {
1313		result.Response = autorest.Response{Response: resp}
1314		err = autorest.NewErrorWithError(err, "catalog.Client", "GetView", resp, "Failure sending request")
1315		return
1316	}
1317
1318	result, err = client.GetViewResponder(resp)
1319	if err != nil {
1320		err = autorest.NewErrorWithError(err, "catalog.Client", "GetView", resp, "Failure responding to request")
1321	}
1322
1323	return
1324}
1325
1326// GetViewPreparer prepares the GetView request.
1327func (client Client) GetViewPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, viewName string) (*http.Request, error) {
1328	urlParameters := map[string]interface{}{
1329		"accountName":          accountName,
1330		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
1331	}
1332
1333	pathParameters := map[string]interface{}{
1334		"databaseName": autorest.Encode("path", databaseName),
1335		"schemaName":   autorest.Encode("path", schemaName),
1336		"viewName":     autorest.Encode("path", viewName),
1337	}
1338
1339	const APIVersion = "2015-10-01-preview"
1340	queryParameters := map[string]interface{}{
1341		"api-version": APIVersion,
1342	}
1343
1344	preparer := autorest.CreatePreparer(
1345		autorest.AsGet(),
1346		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
1347		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/views/{viewName}", pathParameters),
1348		autorest.WithQueryParameters(queryParameters))
1349	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1350}
1351
1352// GetViewSender sends the GetView request. The method will close the
1353// http.Response Body if it receives an error.
1354func (client Client) GetViewSender(req *http.Request) (*http.Response, error) {
1355	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1356	return autorest.SendWithSender(client, req, sd...)
1357}
1358
1359// GetViewResponder handles the response to the GetView request. The method always
1360// closes the http.Response Body.
1361func (client Client) GetViewResponder(resp *http.Response) (result USQLView, err error) {
1362	err = autorest.Respond(
1363		resp,
1364		client.ByInspecting(),
1365		azure.WithErrorUnlessStatusCode(http.StatusOK),
1366		autorest.ByUnmarshallingJSON(&result),
1367		autorest.ByClosing())
1368	result.Response = autorest.Response{Response: resp}
1369	return
1370}
1371
1372// ListAssemblies retrieves the list of assemblies from the Data Lake Analytics catalog.
1373// Parameters:
1374// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
1375// databaseName - the name of the database containing the assembly.
1376// filter - oData filter. Optional.
1377// top - the number of items to return. Optional.
1378// skip - the number of items to skip over before returning elements. Optional.
1379// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
1380// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
1381// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
1382// Categories?$select=CategoryName,Description. Optional.
1383// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
1384// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
1385// Optional.
1386// count - the Boolean value of true or false to request a count of the matching resources included with the
1387// resources in the response, e.g. Categories?$count=true. Optional.
1388func (client Client) ListAssemblies(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLAssemblyListPage, err error) {
1389	if tracing.IsEnabled() {
1390		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAssemblies")
1391		defer func() {
1392			sc := -1
1393			if result.ual.Response.Response != nil {
1394				sc = result.ual.Response.Response.StatusCode
1395			}
1396			tracing.EndSpan(ctx, sc, err)
1397		}()
1398	}
1399	result.fn = client.listAssembliesNextResults
1400	req, err := client.ListAssembliesPreparer(ctx, accountName, databaseName, filter, top, skip, expand, selectParameter, orderby, count)
1401	if err != nil {
1402		err = autorest.NewErrorWithError(err, "catalog.Client", "ListAssemblies", nil, "Failure preparing request")
1403		return
1404	}
1405
1406	resp, err := client.ListAssembliesSender(req)
1407	if err != nil {
1408		result.ual.Response = autorest.Response{Response: resp}
1409		err = autorest.NewErrorWithError(err, "catalog.Client", "ListAssemblies", resp, "Failure sending request")
1410		return
1411	}
1412
1413	result.ual, err = client.ListAssembliesResponder(resp)
1414	if err != nil {
1415		err = autorest.NewErrorWithError(err, "catalog.Client", "ListAssemblies", resp, "Failure responding to request")
1416	}
1417
1418	return
1419}
1420
1421// ListAssembliesPreparer prepares the ListAssemblies request.
1422func (client Client) ListAssembliesPreparer(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
1423	urlParameters := map[string]interface{}{
1424		"accountName":          accountName,
1425		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
1426	}
1427
1428	pathParameters := map[string]interface{}{
1429		"databaseName": autorest.Encode("path", databaseName),
1430	}
1431
1432	const APIVersion = "2015-10-01-preview"
1433	queryParameters := map[string]interface{}{
1434		"api-version": APIVersion,
1435	}
1436	if len(filter) > 0 {
1437		queryParameters["$filter"] = autorest.Encode("query", filter)
1438	}
1439	if top != nil {
1440		queryParameters["$top"] = autorest.Encode("query", *top)
1441	}
1442	if skip != nil {
1443		queryParameters["$skip"] = autorest.Encode("query", *skip)
1444	}
1445	if len(expand) > 0 {
1446		queryParameters["$expand"] = autorest.Encode("query", expand)
1447	}
1448	if len(selectParameter) > 0 {
1449		queryParameters["$select"] = autorest.Encode("query", selectParameter)
1450	}
1451	if len(orderby) > 0 {
1452		queryParameters["$orderby"] = autorest.Encode("query", orderby)
1453	}
1454	if count != nil {
1455		queryParameters["$count"] = autorest.Encode("query", *count)
1456	}
1457
1458	preparer := autorest.CreatePreparer(
1459		autorest.AsGet(),
1460		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
1461		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/assemblies", pathParameters),
1462		autorest.WithQueryParameters(queryParameters))
1463	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1464}
1465
1466// ListAssembliesSender sends the ListAssemblies request. The method will close the
1467// http.Response Body if it receives an error.
1468func (client Client) ListAssembliesSender(req *http.Request) (*http.Response, error) {
1469	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1470	return autorest.SendWithSender(client, req, sd...)
1471}
1472
1473// ListAssembliesResponder handles the response to the ListAssemblies request. The method always
1474// closes the http.Response Body.
1475func (client Client) ListAssembliesResponder(resp *http.Response) (result USQLAssemblyList, err error) {
1476	err = autorest.Respond(
1477		resp,
1478		client.ByInspecting(),
1479		azure.WithErrorUnlessStatusCode(http.StatusOK),
1480		autorest.ByUnmarshallingJSON(&result),
1481		autorest.ByClosing())
1482	result.Response = autorest.Response{Response: resp}
1483	return
1484}
1485
1486// listAssembliesNextResults retrieves the next set of results, if any.
1487func (client Client) listAssembliesNextResults(ctx context.Context, lastResults USQLAssemblyList) (result USQLAssemblyList, err error) {
1488	req, err := lastResults.uSQLAssemblyListPreparer(ctx)
1489	if err != nil {
1490		return result, autorest.NewErrorWithError(err, "catalog.Client", "listAssembliesNextResults", nil, "Failure preparing next results request")
1491	}
1492	if req == nil {
1493		return
1494	}
1495	resp, err := client.ListAssembliesSender(req)
1496	if err != nil {
1497		result.Response = autorest.Response{Response: resp}
1498		return result, autorest.NewErrorWithError(err, "catalog.Client", "listAssembliesNextResults", resp, "Failure sending next results request")
1499	}
1500	result, err = client.ListAssembliesResponder(resp)
1501	if err != nil {
1502		err = autorest.NewErrorWithError(err, "catalog.Client", "listAssembliesNextResults", resp, "Failure responding to next results request")
1503	}
1504	return
1505}
1506
1507// ListAssembliesComplete enumerates all values, automatically crossing page boundaries as required.
1508func (client Client) ListAssembliesComplete(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLAssemblyListIterator, err error) {
1509	if tracing.IsEnabled() {
1510		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAssemblies")
1511		defer func() {
1512			sc := -1
1513			if result.Response().Response.Response != nil {
1514				sc = result.page.Response().Response.Response.StatusCode
1515			}
1516			tracing.EndSpan(ctx, sc, err)
1517		}()
1518	}
1519	result.page, err = client.ListAssemblies(ctx, accountName, databaseName, filter, top, skip, expand, selectParameter, orderby, count)
1520	return
1521}
1522
1523// ListCredentials retrieves the list of credentials from the Data Lake Analytics catalog.
1524// Parameters:
1525// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
1526// databaseName - the name of the database containing the schema.
1527// filter - oData filter. Optional.
1528// top - the number of items to return. Optional.
1529// skip - the number of items to skip over before returning elements. Optional.
1530// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
1531// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
1532// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
1533// Categories?$select=CategoryName,Description. Optional.
1534// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
1535// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
1536// Optional.
1537// count - the Boolean value of true or false to request a count of the matching resources included with the
1538// resources in the response, e.g. Categories?$count=true. Optional.
1539func (client Client) ListCredentials(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLCredentialListPage, err error) {
1540	if tracing.IsEnabled() {
1541		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListCredentials")
1542		defer func() {
1543			sc := -1
1544			if result.ucl.Response.Response != nil {
1545				sc = result.ucl.Response.Response.StatusCode
1546			}
1547			tracing.EndSpan(ctx, sc, err)
1548		}()
1549	}
1550	result.fn = client.listCredentialsNextResults
1551	req, err := client.ListCredentialsPreparer(ctx, accountName, databaseName, filter, top, skip, expand, selectParameter, orderby, count)
1552	if err != nil {
1553		err = autorest.NewErrorWithError(err, "catalog.Client", "ListCredentials", nil, "Failure preparing request")
1554		return
1555	}
1556
1557	resp, err := client.ListCredentialsSender(req)
1558	if err != nil {
1559		result.ucl.Response = autorest.Response{Response: resp}
1560		err = autorest.NewErrorWithError(err, "catalog.Client", "ListCredentials", resp, "Failure sending request")
1561		return
1562	}
1563
1564	result.ucl, err = client.ListCredentialsResponder(resp)
1565	if err != nil {
1566		err = autorest.NewErrorWithError(err, "catalog.Client", "ListCredentials", resp, "Failure responding to request")
1567	}
1568
1569	return
1570}
1571
1572// ListCredentialsPreparer prepares the ListCredentials request.
1573func (client Client) ListCredentialsPreparer(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
1574	urlParameters := map[string]interface{}{
1575		"accountName":          accountName,
1576		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
1577	}
1578
1579	pathParameters := map[string]interface{}{
1580		"databaseName": autorest.Encode("path", databaseName),
1581	}
1582
1583	const APIVersion = "2015-10-01-preview"
1584	queryParameters := map[string]interface{}{
1585		"api-version": APIVersion,
1586	}
1587	if len(filter) > 0 {
1588		queryParameters["$filter"] = autorest.Encode("query", filter)
1589	}
1590	if top != nil {
1591		queryParameters["$top"] = autorest.Encode("query", *top)
1592	}
1593	if skip != nil {
1594		queryParameters["$skip"] = autorest.Encode("query", *skip)
1595	}
1596	if len(expand) > 0 {
1597		queryParameters["$expand"] = autorest.Encode("query", expand)
1598	}
1599	if len(selectParameter) > 0 {
1600		queryParameters["$select"] = autorest.Encode("query", selectParameter)
1601	}
1602	if len(orderby) > 0 {
1603		queryParameters["$orderby"] = autorest.Encode("query", orderby)
1604	}
1605	if count != nil {
1606		queryParameters["$count"] = autorest.Encode("query", *count)
1607	}
1608
1609	preparer := autorest.CreatePreparer(
1610		autorest.AsGet(),
1611		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
1612		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/credentials", pathParameters),
1613		autorest.WithQueryParameters(queryParameters))
1614	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1615}
1616
1617// ListCredentialsSender sends the ListCredentials request. The method will close the
1618// http.Response Body if it receives an error.
1619func (client Client) ListCredentialsSender(req *http.Request) (*http.Response, error) {
1620	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1621	return autorest.SendWithSender(client, req, sd...)
1622}
1623
1624// ListCredentialsResponder handles the response to the ListCredentials request. The method always
1625// closes the http.Response Body.
1626func (client Client) ListCredentialsResponder(resp *http.Response) (result USQLCredentialList, err error) {
1627	err = autorest.Respond(
1628		resp,
1629		client.ByInspecting(),
1630		azure.WithErrorUnlessStatusCode(http.StatusOK),
1631		autorest.ByUnmarshallingJSON(&result),
1632		autorest.ByClosing())
1633	result.Response = autorest.Response{Response: resp}
1634	return
1635}
1636
1637// listCredentialsNextResults retrieves the next set of results, if any.
1638func (client Client) listCredentialsNextResults(ctx context.Context, lastResults USQLCredentialList) (result USQLCredentialList, err error) {
1639	req, err := lastResults.uSQLCredentialListPreparer(ctx)
1640	if err != nil {
1641		return result, autorest.NewErrorWithError(err, "catalog.Client", "listCredentialsNextResults", nil, "Failure preparing next results request")
1642	}
1643	if req == nil {
1644		return
1645	}
1646	resp, err := client.ListCredentialsSender(req)
1647	if err != nil {
1648		result.Response = autorest.Response{Response: resp}
1649		return result, autorest.NewErrorWithError(err, "catalog.Client", "listCredentialsNextResults", resp, "Failure sending next results request")
1650	}
1651	result, err = client.ListCredentialsResponder(resp)
1652	if err != nil {
1653		err = autorest.NewErrorWithError(err, "catalog.Client", "listCredentialsNextResults", resp, "Failure responding to next results request")
1654	}
1655	return
1656}
1657
1658// ListCredentialsComplete enumerates all values, automatically crossing page boundaries as required.
1659func (client Client) ListCredentialsComplete(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLCredentialListIterator, err error) {
1660	if tracing.IsEnabled() {
1661		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListCredentials")
1662		defer func() {
1663			sc := -1
1664			if result.Response().Response.Response != nil {
1665				sc = result.page.Response().Response.Response.StatusCode
1666			}
1667			tracing.EndSpan(ctx, sc, err)
1668		}()
1669	}
1670	result.page, err = client.ListCredentials(ctx, accountName, databaseName, filter, top, skip, expand, selectParameter, orderby, count)
1671	return
1672}
1673
1674// ListDatabases retrieves the list of databases from the Data Lake Analytics catalog.
1675// Parameters:
1676// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
1677// filter - oData filter. Optional.
1678// top - the number of items to return. Optional.
1679// skip - the number of items to skip over before returning elements. Optional.
1680// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
1681// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
1682// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
1683// Categories?$select=CategoryName,Description. Optional.
1684// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
1685// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
1686// Optional.
1687// count - the Boolean value of true or false to request a count of the matching resources included with the
1688// resources in the response, e.g. Categories?$count=true. Optional.
1689func (client Client) ListDatabases(ctx context.Context, accountName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLDatabaseListPage, err error) {
1690	if tracing.IsEnabled() {
1691		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListDatabases")
1692		defer func() {
1693			sc := -1
1694			if result.udl.Response.Response != nil {
1695				sc = result.udl.Response.Response.StatusCode
1696			}
1697			tracing.EndSpan(ctx, sc, err)
1698		}()
1699	}
1700	result.fn = client.listDatabasesNextResults
1701	req, err := client.ListDatabasesPreparer(ctx, accountName, filter, top, skip, expand, selectParameter, orderby, count)
1702	if err != nil {
1703		err = autorest.NewErrorWithError(err, "catalog.Client", "ListDatabases", nil, "Failure preparing request")
1704		return
1705	}
1706
1707	resp, err := client.ListDatabasesSender(req)
1708	if err != nil {
1709		result.udl.Response = autorest.Response{Response: resp}
1710		err = autorest.NewErrorWithError(err, "catalog.Client", "ListDatabases", resp, "Failure sending request")
1711		return
1712	}
1713
1714	result.udl, err = client.ListDatabasesResponder(resp)
1715	if err != nil {
1716		err = autorest.NewErrorWithError(err, "catalog.Client", "ListDatabases", resp, "Failure responding to request")
1717	}
1718
1719	return
1720}
1721
1722// ListDatabasesPreparer prepares the ListDatabases request.
1723func (client Client) ListDatabasesPreparer(ctx context.Context, accountName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
1724	urlParameters := map[string]interface{}{
1725		"accountName":          accountName,
1726		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
1727	}
1728
1729	const APIVersion = "2015-10-01-preview"
1730	queryParameters := map[string]interface{}{
1731		"api-version": APIVersion,
1732	}
1733	if len(filter) > 0 {
1734		queryParameters["$filter"] = autorest.Encode("query", filter)
1735	}
1736	if top != nil {
1737		queryParameters["$top"] = autorest.Encode("query", *top)
1738	}
1739	if skip != nil {
1740		queryParameters["$skip"] = autorest.Encode("query", *skip)
1741	}
1742	if len(expand) > 0 {
1743		queryParameters["$expand"] = autorest.Encode("query", expand)
1744	}
1745	if len(selectParameter) > 0 {
1746		queryParameters["$select"] = autorest.Encode("query", selectParameter)
1747	}
1748	if len(orderby) > 0 {
1749		queryParameters["$orderby"] = autorest.Encode("query", orderby)
1750	}
1751	if count != nil {
1752		queryParameters["$count"] = autorest.Encode("query", *count)
1753	}
1754
1755	preparer := autorest.CreatePreparer(
1756		autorest.AsGet(),
1757		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
1758		autorest.WithPath("/catalog/usql/databases"),
1759		autorest.WithQueryParameters(queryParameters))
1760	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1761}
1762
1763// ListDatabasesSender sends the ListDatabases request. The method will close the
1764// http.Response Body if it receives an error.
1765func (client Client) ListDatabasesSender(req *http.Request) (*http.Response, error) {
1766	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1767	return autorest.SendWithSender(client, req, sd...)
1768}
1769
1770// ListDatabasesResponder handles the response to the ListDatabases request. The method always
1771// closes the http.Response Body.
1772func (client Client) ListDatabasesResponder(resp *http.Response) (result USQLDatabaseList, err error) {
1773	err = autorest.Respond(
1774		resp,
1775		client.ByInspecting(),
1776		azure.WithErrorUnlessStatusCode(http.StatusOK),
1777		autorest.ByUnmarshallingJSON(&result),
1778		autorest.ByClosing())
1779	result.Response = autorest.Response{Response: resp}
1780	return
1781}
1782
1783// listDatabasesNextResults retrieves the next set of results, if any.
1784func (client Client) listDatabasesNextResults(ctx context.Context, lastResults USQLDatabaseList) (result USQLDatabaseList, err error) {
1785	req, err := lastResults.uSQLDatabaseListPreparer(ctx)
1786	if err != nil {
1787		return result, autorest.NewErrorWithError(err, "catalog.Client", "listDatabasesNextResults", nil, "Failure preparing next results request")
1788	}
1789	if req == nil {
1790		return
1791	}
1792	resp, err := client.ListDatabasesSender(req)
1793	if err != nil {
1794		result.Response = autorest.Response{Response: resp}
1795		return result, autorest.NewErrorWithError(err, "catalog.Client", "listDatabasesNextResults", resp, "Failure sending next results request")
1796	}
1797	result, err = client.ListDatabasesResponder(resp)
1798	if err != nil {
1799		err = autorest.NewErrorWithError(err, "catalog.Client", "listDatabasesNextResults", resp, "Failure responding to next results request")
1800	}
1801	return
1802}
1803
1804// ListDatabasesComplete enumerates all values, automatically crossing page boundaries as required.
1805func (client Client) ListDatabasesComplete(ctx context.Context, accountName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLDatabaseListIterator, err error) {
1806	if tracing.IsEnabled() {
1807		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListDatabases")
1808		defer func() {
1809			sc := -1
1810			if result.Response().Response.Response != nil {
1811				sc = result.page.Response().Response.Response.StatusCode
1812			}
1813			tracing.EndSpan(ctx, sc, err)
1814		}()
1815	}
1816	result.page, err = client.ListDatabases(ctx, accountName, filter, top, skip, expand, selectParameter, orderby, count)
1817	return
1818}
1819
1820// ListExternalDataSources retrieves the list of external data sources from the Data Lake Analytics catalog.
1821// Parameters:
1822// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
1823// databaseName - the name of the database containing the external data sources.
1824// filter - oData filter. Optional.
1825// top - the number of items to return. Optional.
1826// skip - the number of items to skip over before returning elements. Optional.
1827// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
1828// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
1829// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
1830// Categories?$select=CategoryName,Description. Optional.
1831// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
1832// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
1833// Optional.
1834// count - the Boolean value of true or false to request a count of the matching resources included with the
1835// resources in the response, e.g. Categories?$count=true. Optional.
1836func (client Client) ListExternalDataSources(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLExternalDataSourceListPage, err error) {
1837	if tracing.IsEnabled() {
1838		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListExternalDataSources")
1839		defer func() {
1840			sc := -1
1841			if result.uedsl.Response.Response != nil {
1842				sc = result.uedsl.Response.Response.StatusCode
1843			}
1844			tracing.EndSpan(ctx, sc, err)
1845		}()
1846	}
1847	result.fn = client.listExternalDataSourcesNextResults
1848	req, err := client.ListExternalDataSourcesPreparer(ctx, accountName, databaseName, filter, top, skip, expand, selectParameter, orderby, count)
1849	if err != nil {
1850		err = autorest.NewErrorWithError(err, "catalog.Client", "ListExternalDataSources", nil, "Failure preparing request")
1851		return
1852	}
1853
1854	resp, err := client.ListExternalDataSourcesSender(req)
1855	if err != nil {
1856		result.uedsl.Response = autorest.Response{Response: resp}
1857		err = autorest.NewErrorWithError(err, "catalog.Client", "ListExternalDataSources", resp, "Failure sending request")
1858		return
1859	}
1860
1861	result.uedsl, err = client.ListExternalDataSourcesResponder(resp)
1862	if err != nil {
1863		err = autorest.NewErrorWithError(err, "catalog.Client", "ListExternalDataSources", resp, "Failure responding to request")
1864	}
1865
1866	return
1867}
1868
1869// ListExternalDataSourcesPreparer prepares the ListExternalDataSources request.
1870func (client Client) ListExternalDataSourcesPreparer(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
1871	urlParameters := map[string]interface{}{
1872		"accountName":          accountName,
1873		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
1874	}
1875
1876	pathParameters := map[string]interface{}{
1877		"databaseName": autorest.Encode("path", databaseName),
1878	}
1879
1880	const APIVersion = "2015-10-01-preview"
1881	queryParameters := map[string]interface{}{
1882		"api-version": APIVersion,
1883	}
1884	if len(filter) > 0 {
1885		queryParameters["$filter"] = autorest.Encode("query", filter)
1886	}
1887	if top != nil {
1888		queryParameters["$top"] = autorest.Encode("query", *top)
1889	}
1890	if skip != nil {
1891		queryParameters["$skip"] = autorest.Encode("query", *skip)
1892	}
1893	if len(expand) > 0 {
1894		queryParameters["$expand"] = autorest.Encode("query", expand)
1895	}
1896	if len(selectParameter) > 0 {
1897		queryParameters["$select"] = autorest.Encode("query", selectParameter)
1898	}
1899	if len(orderby) > 0 {
1900		queryParameters["$orderby"] = autorest.Encode("query", orderby)
1901	}
1902	if count != nil {
1903		queryParameters["$count"] = autorest.Encode("query", *count)
1904	}
1905
1906	preparer := autorest.CreatePreparer(
1907		autorest.AsGet(),
1908		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
1909		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/externaldatasources", pathParameters),
1910		autorest.WithQueryParameters(queryParameters))
1911	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1912}
1913
1914// ListExternalDataSourcesSender sends the ListExternalDataSources request. The method will close the
1915// http.Response Body if it receives an error.
1916func (client Client) ListExternalDataSourcesSender(req *http.Request) (*http.Response, error) {
1917	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1918	return autorest.SendWithSender(client, req, sd...)
1919}
1920
1921// ListExternalDataSourcesResponder handles the response to the ListExternalDataSources request. The method always
1922// closes the http.Response Body.
1923func (client Client) ListExternalDataSourcesResponder(resp *http.Response) (result USQLExternalDataSourceList, err error) {
1924	err = autorest.Respond(
1925		resp,
1926		client.ByInspecting(),
1927		azure.WithErrorUnlessStatusCode(http.StatusOK),
1928		autorest.ByUnmarshallingJSON(&result),
1929		autorest.ByClosing())
1930	result.Response = autorest.Response{Response: resp}
1931	return
1932}
1933
1934// listExternalDataSourcesNextResults retrieves the next set of results, if any.
1935func (client Client) listExternalDataSourcesNextResults(ctx context.Context, lastResults USQLExternalDataSourceList) (result USQLExternalDataSourceList, err error) {
1936	req, err := lastResults.uSQLExternalDataSourceListPreparer(ctx)
1937	if err != nil {
1938		return result, autorest.NewErrorWithError(err, "catalog.Client", "listExternalDataSourcesNextResults", nil, "Failure preparing next results request")
1939	}
1940	if req == nil {
1941		return
1942	}
1943	resp, err := client.ListExternalDataSourcesSender(req)
1944	if err != nil {
1945		result.Response = autorest.Response{Response: resp}
1946		return result, autorest.NewErrorWithError(err, "catalog.Client", "listExternalDataSourcesNextResults", resp, "Failure sending next results request")
1947	}
1948	result, err = client.ListExternalDataSourcesResponder(resp)
1949	if err != nil {
1950		err = autorest.NewErrorWithError(err, "catalog.Client", "listExternalDataSourcesNextResults", resp, "Failure responding to next results request")
1951	}
1952	return
1953}
1954
1955// ListExternalDataSourcesComplete enumerates all values, automatically crossing page boundaries as required.
1956func (client Client) ListExternalDataSourcesComplete(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLExternalDataSourceListIterator, err error) {
1957	if tracing.IsEnabled() {
1958		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListExternalDataSources")
1959		defer func() {
1960			sc := -1
1961			if result.Response().Response.Response != nil {
1962				sc = result.page.Response().Response.Response.StatusCode
1963			}
1964			tracing.EndSpan(ctx, sc, err)
1965		}()
1966	}
1967	result.page, err = client.ListExternalDataSources(ctx, accountName, databaseName, filter, top, skip, expand, selectParameter, orderby, count)
1968	return
1969}
1970
1971// ListProcedures retrieves the list of procedures from the Data Lake Analytics catalog.
1972// Parameters:
1973// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
1974// databaseName - the name of the database containing the procedures.
1975// schemaName - the name of the schema containing the procedures.
1976// filter - oData filter. Optional.
1977// top - the number of items to return. Optional.
1978// skip - the number of items to skip over before returning elements. Optional.
1979// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
1980// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
1981// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
1982// Categories?$select=CategoryName,Description. Optional.
1983// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
1984// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
1985// Optional.
1986// count - the Boolean value of true or false to request a count of the matching resources included with the
1987// resources in the response, e.g. Categories?$count=true. Optional.
1988func (client Client) ListProcedures(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLProcedureListPage, err error) {
1989	if tracing.IsEnabled() {
1990		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListProcedures")
1991		defer func() {
1992			sc := -1
1993			if result.upl.Response.Response != nil {
1994				sc = result.upl.Response.Response.StatusCode
1995			}
1996			tracing.EndSpan(ctx, sc, err)
1997		}()
1998	}
1999	result.fn = client.listProceduresNextResults
2000	req, err := client.ListProceduresPreparer(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
2001	if err != nil {
2002		err = autorest.NewErrorWithError(err, "catalog.Client", "ListProcedures", nil, "Failure preparing request")
2003		return
2004	}
2005
2006	resp, err := client.ListProceduresSender(req)
2007	if err != nil {
2008		result.upl.Response = autorest.Response{Response: resp}
2009		err = autorest.NewErrorWithError(err, "catalog.Client", "ListProcedures", resp, "Failure sending request")
2010		return
2011	}
2012
2013	result.upl, err = client.ListProceduresResponder(resp)
2014	if err != nil {
2015		err = autorest.NewErrorWithError(err, "catalog.Client", "ListProcedures", resp, "Failure responding to request")
2016	}
2017
2018	return
2019}
2020
2021// ListProceduresPreparer prepares the ListProcedures request.
2022func (client Client) ListProceduresPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
2023	urlParameters := map[string]interface{}{
2024		"accountName":          accountName,
2025		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
2026	}
2027
2028	pathParameters := map[string]interface{}{
2029		"databaseName": autorest.Encode("path", databaseName),
2030		"schemaName":   autorest.Encode("path", schemaName),
2031	}
2032
2033	const APIVersion = "2015-10-01-preview"
2034	queryParameters := map[string]interface{}{
2035		"api-version": APIVersion,
2036	}
2037	if len(filter) > 0 {
2038		queryParameters["$filter"] = autorest.Encode("query", filter)
2039	}
2040	if top != nil {
2041		queryParameters["$top"] = autorest.Encode("query", *top)
2042	}
2043	if skip != nil {
2044		queryParameters["$skip"] = autorest.Encode("query", *skip)
2045	}
2046	if len(expand) > 0 {
2047		queryParameters["$expand"] = autorest.Encode("query", expand)
2048	}
2049	if len(selectParameter) > 0 {
2050		queryParameters["$select"] = autorest.Encode("query", selectParameter)
2051	}
2052	if len(orderby) > 0 {
2053		queryParameters["$orderby"] = autorest.Encode("query", orderby)
2054	}
2055	if count != nil {
2056		queryParameters["$count"] = autorest.Encode("query", *count)
2057	}
2058
2059	preparer := autorest.CreatePreparer(
2060		autorest.AsGet(),
2061		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
2062		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/procedures", pathParameters),
2063		autorest.WithQueryParameters(queryParameters))
2064	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2065}
2066
2067// ListProceduresSender sends the ListProcedures request. The method will close the
2068// http.Response Body if it receives an error.
2069func (client Client) ListProceduresSender(req *http.Request) (*http.Response, error) {
2070	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2071	return autorest.SendWithSender(client, req, sd...)
2072}
2073
2074// ListProceduresResponder handles the response to the ListProcedures request. The method always
2075// closes the http.Response Body.
2076func (client Client) ListProceduresResponder(resp *http.Response) (result USQLProcedureList, err error) {
2077	err = autorest.Respond(
2078		resp,
2079		client.ByInspecting(),
2080		azure.WithErrorUnlessStatusCode(http.StatusOK),
2081		autorest.ByUnmarshallingJSON(&result),
2082		autorest.ByClosing())
2083	result.Response = autorest.Response{Response: resp}
2084	return
2085}
2086
2087// listProceduresNextResults retrieves the next set of results, if any.
2088func (client Client) listProceduresNextResults(ctx context.Context, lastResults USQLProcedureList) (result USQLProcedureList, err error) {
2089	req, err := lastResults.uSQLProcedureListPreparer(ctx)
2090	if err != nil {
2091		return result, autorest.NewErrorWithError(err, "catalog.Client", "listProceduresNextResults", nil, "Failure preparing next results request")
2092	}
2093	if req == nil {
2094		return
2095	}
2096	resp, err := client.ListProceduresSender(req)
2097	if err != nil {
2098		result.Response = autorest.Response{Response: resp}
2099		return result, autorest.NewErrorWithError(err, "catalog.Client", "listProceduresNextResults", resp, "Failure sending next results request")
2100	}
2101	result, err = client.ListProceduresResponder(resp)
2102	if err != nil {
2103		err = autorest.NewErrorWithError(err, "catalog.Client", "listProceduresNextResults", resp, "Failure responding to next results request")
2104	}
2105	return
2106}
2107
2108// ListProceduresComplete enumerates all values, automatically crossing page boundaries as required.
2109func (client Client) ListProceduresComplete(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLProcedureListIterator, err error) {
2110	if tracing.IsEnabled() {
2111		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListProcedures")
2112		defer func() {
2113			sc := -1
2114			if result.Response().Response.Response != nil {
2115				sc = result.page.Response().Response.Response.StatusCode
2116			}
2117			tracing.EndSpan(ctx, sc, err)
2118		}()
2119	}
2120	result.page, err = client.ListProcedures(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
2121	return
2122}
2123
2124// ListSchemas retrieves the list of schemas from the Data Lake Analytics catalog.
2125// Parameters:
2126// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
2127// databaseName - the name of the database containing the schema.
2128// filter - oData filter. Optional.
2129// top - the number of items to return. Optional.
2130// skip - the number of items to skip over before returning elements. Optional.
2131// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
2132// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
2133// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
2134// Categories?$select=CategoryName,Description. Optional.
2135// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
2136// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
2137// Optional.
2138// count - the Boolean value of true or false to request a count of the matching resources included with the
2139// resources in the response, e.g. Categories?$count=true. Optional.
2140func (client Client) ListSchemas(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLSchemaListPage, err error) {
2141	if tracing.IsEnabled() {
2142		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListSchemas")
2143		defer func() {
2144			sc := -1
2145			if result.usl.Response.Response != nil {
2146				sc = result.usl.Response.Response.StatusCode
2147			}
2148			tracing.EndSpan(ctx, sc, err)
2149		}()
2150	}
2151	result.fn = client.listSchemasNextResults
2152	req, err := client.ListSchemasPreparer(ctx, accountName, databaseName, filter, top, skip, expand, selectParameter, orderby, count)
2153	if err != nil {
2154		err = autorest.NewErrorWithError(err, "catalog.Client", "ListSchemas", nil, "Failure preparing request")
2155		return
2156	}
2157
2158	resp, err := client.ListSchemasSender(req)
2159	if err != nil {
2160		result.usl.Response = autorest.Response{Response: resp}
2161		err = autorest.NewErrorWithError(err, "catalog.Client", "ListSchemas", resp, "Failure sending request")
2162		return
2163	}
2164
2165	result.usl, err = client.ListSchemasResponder(resp)
2166	if err != nil {
2167		err = autorest.NewErrorWithError(err, "catalog.Client", "ListSchemas", resp, "Failure responding to request")
2168	}
2169
2170	return
2171}
2172
2173// ListSchemasPreparer prepares the ListSchemas request.
2174func (client Client) ListSchemasPreparer(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
2175	urlParameters := map[string]interface{}{
2176		"accountName":          accountName,
2177		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
2178	}
2179
2180	pathParameters := map[string]interface{}{
2181		"databaseName": autorest.Encode("path", databaseName),
2182	}
2183
2184	const APIVersion = "2015-10-01-preview"
2185	queryParameters := map[string]interface{}{
2186		"api-version": APIVersion,
2187	}
2188	if len(filter) > 0 {
2189		queryParameters["$filter"] = autorest.Encode("query", filter)
2190	}
2191	if top != nil {
2192		queryParameters["$top"] = autorest.Encode("query", *top)
2193	}
2194	if skip != nil {
2195		queryParameters["$skip"] = autorest.Encode("query", *skip)
2196	}
2197	if len(expand) > 0 {
2198		queryParameters["$expand"] = autorest.Encode("query", expand)
2199	}
2200	if len(selectParameter) > 0 {
2201		queryParameters["$select"] = autorest.Encode("query", selectParameter)
2202	}
2203	if len(orderby) > 0 {
2204		queryParameters["$orderby"] = autorest.Encode("query", orderby)
2205	}
2206	if count != nil {
2207		queryParameters["$count"] = autorest.Encode("query", *count)
2208	}
2209
2210	preparer := autorest.CreatePreparer(
2211		autorest.AsGet(),
2212		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
2213		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas", pathParameters),
2214		autorest.WithQueryParameters(queryParameters))
2215	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2216}
2217
2218// ListSchemasSender sends the ListSchemas request. The method will close the
2219// http.Response Body if it receives an error.
2220func (client Client) ListSchemasSender(req *http.Request) (*http.Response, error) {
2221	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2222	return autorest.SendWithSender(client, req, sd...)
2223}
2224
2225// ListSchemasResponder handles the response to the ListSchemas request. The method always
2226// closes the http.Response Body.
2227func (client Client) ListSchemasResponder(resp *http.Response) (result USQLSchemaList, err error) {
2228	err = autorest.Respond(
2229		resp,
2230		client.ByInspecting(),
2231		azure.WithErrorUnlessStatusCode(http.StatusOK),
2232		autorest.ByUnmarshallingJSON(&result),
2233		autorest.ByClosing())
2234	result.Response = autorest.Response{Response: resp}
2235	return
2236}
2237
2238// listSchemasNextResults retrieves the next set of results, if any.
2239func (client Client) listSchemasNextResults(ctx context.Context, lastResults USQLSchemaList) (result USQLSchemaList, err error) {
2240	req, err := lastResults.uSQLSchemaListPreparer(ctx)
2241	if err != nil {
2242		return result, autorest.NewErrorWithError(err, "catalog.Client", "listSchemasNextResults", nil, "Failure preparing next results request")
2243	}
2244	if req == nil {
2245		return
2246	}
2247	resp, err := client.ListSchemasSender(req)
2248	if err != nil {
2249		result.Response = autorest.Response{Response: resp}
2250		return result, autorest.NewErrorWithError(err, "catalog.Client", "listSchemasNextResults", resp, "Failure sending next results request")
2251	}
2252	result, err = client.ListSchemasResponder(resp)
2253	if err != nil {
2254		err = autorest.NewErrorWithError(err, "catalog.Client", "listSchemasNextResults", resp, "Failure responding to next results request")
2255	}
2256	return
2257}
2258
2259// ListSchemasComplete enumerates all values, automatically crossing page boundaries as required.
2260func (client Client) ListSchemasComplete(ctx context.Context, accountName string, databaseName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLSchemaListIterator, err error) {
2261	if tracing.IsEnabled() {
2262		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListSchemas")
2263		defer func() {
2264			sc := -1
2265			if result.Response().Response.Response != nil {
2266				sc = result.page.Response().Response.Response.StatusCode
2267			}
2268			tracing.EndSpan(ctx, sc, err)
2269		}()
2270	}
2271	result.page, err = client.ListSchemas(ctx, accountName, databaseName, filter, top, skip, expand, selectParameter, orderby, count)
2272	return
2273}
2274
2275// ListTablePartitions retrieves the list of table partitions from the Data Lake Analytics catalog.
2276// Parameters:
2277// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
2278// databaseName - the name of the database containing the partitions.
2279// schemaName - the name of the schema containing the partitions.
2280// tableName - the name of the table containing the partitions.
2281// filter - oData filter. Optional.
2282// top - the number of items to return. Optional.
2283// skip - the number of items to skip over before returning elements. Optional.
2284// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
2285// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
2286// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
2287// Categories?$select=CategoryName,Description. Optional.
2288// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
2289// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
2290// Optional.
2291// count - the Boolean value of true or false to request a count of the matching resources included with the
2292// resources in the response, e.g. Categories?$count=true. Optional.
2293func (client Client) ListTablePartitions(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTablePartitionListPage, err error) {
2294	if tracing.IsEnabled() {
2295		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTablePartitions")
2296		defer func() {
2297			sc := -1
2298			if result.utpl.Response.Response != nil {
2299				sc = result.utpl.Response.Response.StatusCode
2300			}
2301			tracing.EndSpan(ctx, sc, err)
2302		}()
2303	}
2304	result.fn = client.listTablePartitionsNextResults
2305	req, err := client.ListTablePartitionsPreparer(ctx, accountName, databaseName, schemaName, tableName, filter, top, skip, expand, selectParameter, orderby, count)
2306	if err != nil {
2307		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTablePartitions", nil, "Failure preparing request")
2308		return
2309	}
2310
2311	resp, err := client.ListTablePartitionsSender(req)
2312	if err != nil {
2313		result.utpl.Response = autorest.Response{Response: resp}
2314		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTablePartitions", resp, "Failure sending request")
2315		return
2316	}
2317
2318	result.utpl, err = client.ListTablePartitionsResponder(resp)
2319	if err != nil {
2320		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTablePartitions", resp, "Failure responding to request")
2321	}
2322
2323	return
2324}
2325
2326// ListTablePartitionsPreparer prepares the ListTablePartitions request.
2327func (client Client) ListTablePartitionsPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
2328	urlParameters := map[string]interface{}{
2329		"accountName":          accountName,
2330		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
2331	}
2332
2333	pathParameters := map[string]interface{}{
2334		"databaseName": autorest.Encode("path", databaseName),
2335		"schemaName":   autorest.Encode("path", schemaName),
2336		"tableName":    autorest.Encode("path", tableName),
2337	}
2338
2339	const APIVersion = "2015-10-01-preview"
2340	queryParameters := map[string]interface{}{
2341		"api-version": APIVersion,
2342	}
2343	if len(filter) > 0 {
2344		queryParameters["$filter"] = autorest.Encode("query", filter)
2345	}
2346	if top != nil {
2347		queryParameters["$top"] = autorest.Encode("query", *top)
2348	}
2349	if skip != nil {
2350		queryParameters["$skip"] = autorest.Encode("query", *skip)
2351	}
2352	if len(expand) > 0 {
2353		queryParameters["$expand"] = autorest.Encode("query", expand)
2354	}
2355	if len(selectParameter) > 0 {
2356		queryParameters["$select"] = autorest.Encode("query", selectParameter)
2357	}
2358	if len(orderby) > 0 {
2359		queryParameters["$orderby"] = autorest.Encode("query", orderby)
2360	}
2361	if count != nil {
2362		queryParameters["$count"] = autorest.Encode("query", *count)
2363	}
2364
2365	preparer := autorest.CreatePreparer(
2366		autorest.AsGet(),
2367		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
2368		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/partitions", pathParameters),
2369		autorest.WithQueryParameters(queryParameters))
2370	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2371}
2372
2373// ListTablePartitionsSender sends the ListTablePartitions request. The method will close the
2374// http.Response Body if it receives an error.
2375func (client Client) ListTablePartitionsSender(req *http.Request) (*http.Response, error) {
2376	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2377	return autorest.SendWithSender(client, req, sd...)
2378}
2379
2380// ListTablePartitionsResponder handles the response to the ListTablePartitions request. The method always
2381// closes the http.Response Body.
2382func (client Client) ListTablePartitionsResponder(resp *http.Response) (result USQLTablePartitionList, err error) {
2383	err = autorest.Respond(
2384		resp,
2385		client.ByInspecting(),
2386		azure.WithErrorUnlessStatusCode(http.StatusOK),
2387		autorest.ByUnmarshallingJSON(&result),
2388		autorest.ByClosing())
2389	result.Response = autorest.Response{Response: resp}
2390	return
2391}
2392
2393// listTablePartitionsNextResults retrieves the next set of results, if any.
2394func (client Client) listTablePartitionsNextResults(ctx context.Context, lastResults USQLTablePartitionList) (result USQLTablePartitionList, err error) {
2395	req, err := lastResults.uSQLTablePartitionListPreparer(ctx)
2396	if err != nil {
2397		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTablePartitionsNextResults", nil, "Failure preparing next results request")
2398	}
2399	if req == nil {
2400		return
2401	}
2402	resp, err := client.ListTablePartitionsSender(req)
2403	if err != nil {
2404		result.Response = autorest.Response{Response: resp}
2405		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTablePartitionsNextResults", resp, "Failure sending next results request")
2406	}
2407	result, err = client.ListTablePartitionsResponder(resp)
2408	if err != nil {
2409		err = autorest.NewErrorWithError(err, "catalog.Client", "listTablePartitionsNextResults", resp, "Failure responding to next results request")
2410	}
2411	return
2412}
2413
2414// ListTablePartitionsComplete enumerates all values, automatically crossing page boundaries as required.
2415func (client Client) ListTablePartitionsComplete(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTablePartitionListIterator, err error) {
2416	if tracing.IsEnabled() {
2417		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTablePartitions")
2418		defer func() {
2419			sc := -1
2420			if result.Response().Response.Response != nil {
2421				sc = result.page.Response().Response.Response.StatusCode
2422			}
2423			tracing.EndSpan(ctx, sc, err)
2424		}()
2425	}
2426	result.page, err = client.ListTablePartitions(ctx, accountName, databaseName, schemaName, tableName, filter, top, skip, expand, selectParameter, orderby, count)
2427	return
2428}
2429
2430// ListTables retrieves the list of tables from the Data Lake Analytics catalog.
2431// Parameters:
2432// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
2433// databaseName - the name of the database containing the tables.
2434// schemaName - the name of the schema containing the tables.
2435// filter - oData filter. Optional.
2436// top - the number of items to return. Optional.
2437// skip - the number of items to skip over before returning elements. Optional.
2438// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
2439// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
2440// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
2441// Categories?$select=CategoryName,Description. Optional.
2442// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
2443// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
2444// Optional.
2445// count - the Boolean value of true or false to request a count of the matching resources included with the
2446// resources in the response, e.g. Categories?$count=true. Optional.
2447func (client Client) ListTables(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTableListPage, err error) {
2448	if tracing.IsEnabled() {
2449		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTables")
2450		defer func() {
2451			sc := -1
2452			if result.utl.Response.Response != nil {
2453				sc = result.utl.Response.Response.StatusCode
2454			}
2455			tracing.EndSpan(ctx, sc, err)
2456		}()
2457	}
2458	result.fn = client.listTablesNextResults
2459	req, err := client.ListTablesPreparer(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
2460	if err != nil {
2461		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTables", nil, "Failure preparing request")
2462		return
2463	}
2464
2465	resp, err := client.ListTablesSender(req)
2466	if err != nil {
2467		result.utl.Response = autorest.Response{Response: resp}
2468		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTables", resp, "Failure sending request")
2469		return
2470	}
2471
2472	result.utl, err = client.ListTablesResponder(resp)
2473	if err != nil {
2474		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTables", resp, "Failure responding to request")
2475	}
2476
2477	return
2478}
2479
2480// ListTablesPreparer prepares the ListTables request.
2481func (client Client) ListTablesPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
2482	urlParameters := map[string]interface{}{
2483		"accountName":          accountName,
2484		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
2485	}
2486
2487	pathParameters := map[string]interface{}{
2488		"databaseName": autorest.Encode("path", databaseName),
2489		"schemaName":   autorest.Encode("path", schemaName),
2490	}
2491
2492	const APIVersion = "2015-10-01-preview"
2493	queryParameters := map[string]interface{}{
2494		"api-version": APIVersion,
2495	}
2496	if len(filter) > 0 {
2497		queryParameters["$filter"] = autorest.Encode("query", filter)
2498	}
2499	if top != nil {
2500		queryParameters["$top"] = autorest.Encode("query", *top)
2501	}
2502	if skip != nil {
2503		queryParameters["$skip"] = autorest.Encode("query", *skip)
2504	}
2505	if len(expand) > 0 {
2506		queryParameters["$expand"] = autorest.Encode("query", expand)
2507	}
2508	if len(selectParameter) > 0 {
2509		queryParameters["$select"] = autorest.Encode("query", selectParameter)
2510	}
2511	if len(orderby) > 0 {
2512		queryParameters["$orderby"] = autorest.Encode("query", orderby)
2513	}
2514	if count != nil {
2515		queryParameters["$count"] = autorest.Encode("query", *count)
2516	}
2517
2518	preparer := autorest.CreatePreparer(
2519		autorest.AsGet(),
2520		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
2521		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/tables", pathParameters),
2522		autorest.WithQueryParameters(queryParameters))
2523	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2524}
2525
2526// ListTablesSender sends the ListTables request. The method will close the
2527// http.Response Body if it receives an error.
2528func (client Client) ListTablesSender(req *http.Request) (*http.Response, error) {
2529	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2530	return autorest.SendWithSender(client, req, sd...)
2531}
2532
2533// ListTablesResponder handles the response to the ListTables request. The method always
2534// closes the http.Response Body.
2535func (client Client) ListTablesResponder(resp *http.Response) (result USQLTableList, err error) {
2536	err = autorest.Respond(
2537		resp,
2538		client.ByInspecting(),
2539		azure.WithErrorUnlessStatusCode(http.StatusOK),
2540		autorest.ByUnmarshallingJSON(&result),
2541		autorest.ByClosing())
2542	result.Response = autorest.Response{Response: resp}
2543	return
2544}
2545
2546// listTablesNextResults retrieves the next set of results, if any.
2547func (client Client) listTablesNextResults(ctx context.Context, lastResults USQLTableList) (result USQLTableList, err error) {
2548	req, err := lastResults.uSQLTableListPreparer(ctx)
2549	if err != nil {
2550		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTablesNextResults", nil, "Failure preparing next results request")
2551	}
2552	if req == nil {
2553		return
2554	}
2555	resp, err := client.ListTablesSender(req)
2556	if err != nil {
2557		result.Response = autorest.Response{Response: resp}
2558		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTablesNextResults", resp, "Failure sending next results request")
2559	}
2560	result, err = client.ListTablesResponder(resp)
2561	if err != nil {
2562		err = autorest.NewErrorWithError(err, "catalog.Client", "listTablesNextResults", resp, "Failure responding to next results request")
2563	}
2564	return
2565}
2566
2567// ListTablesComplete enumerates all values, automatically crossing page boundaries as required.
2568func (client Client) ListTablesComplete(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTableListIterator, err error) {
2569	if tracing.IsEnabled() {
2570		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTables")
2571		defer func() {
2572			sc := -1
2573			if result.Response().Response.Response != nil {
2574				sc = result.page.Response().Response.Response.StatusCode
2575			}
2576			tracing.EndSpan(ctx, sc, err)
2577		}()
2578	}
2579	result.page, err = client.ListTables(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
2580	return
2581}
2582
2583// ListTableStatistics retrieves the list of table statistics from the Data Lake Analytics catalog.
2584// Parameters:
2585// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
2586// databaseName - the name of the database containing the statistics.
2587// schemaName - the name of the schema containing the statistics.
2588// tableName - the name of the table containing the statistics.
2589// filter - oData filter. Optional.
2590// top - the number of items to return. Optional.
2591// skip - the number of items to skip over before returning elements. Optional.
2592// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
2593// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
2594// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
2595// Categories?$select=CategoryName,Description. Optional.
2596// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
2597// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
2598// Optional.
2599// count - the Boolean value of true or false to request a count of the matching resources included with the
2600// resources in the response, e.g. Categories?$count=true. Optional.
2601func (client Client) ListTableStatistics(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTableStatisticsListPage, err error) {
2602	if tracing.IsEnabled() {
2603		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTableStatistics")
2604		defer func() {
2605			sc := -1
2606			if result.utsl.Response.Response != nil {
2607				sc = result.utsl.Response.Response.StatusCode
2608			}
2609			tracing.EndSpan(ctx, sc, err)
2610		}()
2611	}
2612	result.fn = client.listTableStatisticsNextResults
2613	req, err := client.ListTableStatisticsPreparer(ctx, accountName, databaseName, schemaName, tableName, filter, top, skip, expand, selectParameter, orderby, count)
2614	if err != nil {
2615		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTableStatistics", nil, "Failure preparing request")
2616		return
2617	}
2618
2619	resp, err := client.ListTableStatisticsSender(req)
2620	if err != nil {
2621		result.utsl.Response = autorest.Response{Response: resp}
2622		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTableStatistics", resp, "Failure sending request")
2623		return
2624	}
2625
2626	result.utsl, err = client.ListTableStatisticsResponder(resp)
2627	if err != nil {
2628		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTableStatistics", resp, "Failure responding to request")
2629	}
2630
2631	return
2632}
2633
2634// ListTableStatisticsPreparer prepares the ListTableStatistics request.
2635func (client Client) ListTableStatisticsPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
2636	urlParameters := map[string]interface{}{
2637		"accountName":          accountName,
2638		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
2639	}
2640
2641	pathParameters := map[string]interface{}{
2642		"databaseName": autorest.Encode("path", databaseName),
2643		"schemaName":   autorest.Encode("path", schemaName),
2644		"tableName":    autorest.Encode("path", tableName),
2645	}
2646
2647	const APIVersion = "2015-10-01-preview"
2648	queryParameters := map[string]interface{}{
2649		"api-version": APIVersion,
2650	}
2651	if len(filter) > 0 {
2652		queryParameters["$filter"] = autorest.Encode("query", filter)
2653	}
2654	if top != nil {
2655		queryParameters["$top"] = autorest.Encode("query", *top)
2656	}
2657	if skip != nil {
2658		queryParameters["$skip"] = autorest.Encode("query", *skip)
2659	}
2660	if len(expand) > 0 {
2661		queryParameters["$expand"] = autorest.Encode("query", expand)
2662	}
2663	if len(selectParameter) > 0 {
2664		queryParameters["$select"] = autorest.Encode("query", selectParameter)
2665	}
2666	if len(orderby) > 0 {
2667		queryParameters["$orderby"] = autorest.Encode("query", orderby)
2668	}
2669	if count != nil {
2670		queryParameters["$count"] = autorest.Encode("query", *count)
2671	}
2672
2673	preparer := autorest.CreatePreparer(
2674		autorest.AsGet(),
2675		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
2676		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/statistics", pathParameters),
2677		autorest.WithQueryParameters(queryParameters))
2678	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2679}
2680
2681// ListTableStatisticsSender sends the ListTableStatistics request. The method will close the
2682// http.Response Body if it receives an error.
2683func (client Client) ListTableStatisticsSender(req *http.Request) (*http.Response, error) {
2684	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2685	return autorest.SendWithSender(client, req, sd...)
2686}
2687
2688// ListTableStatisticsResponder handles the response to the ListTableStatistics request. The method always
2689// closes the http.Response Body.
2690func (client Client) ListTableStatisticsResponder(resp *http.Response) (result USQLTableStatisticsList, err error) {
2691	err = autorest.Respond(
2692		resp,
2693		client.ByInspecting(),
2694		azure.WithErrorUnlessStatusCode(http.StatusOK),
2695		autorest.ByUnmarshallingJSON(&result),
2696		autorest.ByClosing())
2697	result.Response = autorest.Response{Response: resp}
2698	return
2699}
2700
2701// listTableStatisticsNextResults retrieves the next set of results, if any.
2702func (client Client) listTableStatisticsNextResults(ctx context.Context, lastResults USQLTableStatisticsList) (result USQLTableStatisticsList, err error) {
2703	req, err := lastResults.uSQLTableStatisticsListPreparer(ctx)
2704	if err != nil {
2705		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTableStatisticsNextResults", nil, "Failure preparing next results request")
2706	}
2707	if req == nil {
2708		return
2709	}
2710	resp, err := client.ListTableStatisticsSender(req)
2711	if err != nil {
2712		result.Response = autorest.Response{Response: resp}
2713		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTableStatisticsNextResults", resp, "Failure sending next results request")
2714	}
2715	result, err = client.ListTableStatisticsResponder(resp)
2716	if err != nil {
2717		err = autorest.NewErrorWithError(err, "catalog.Client", "listTableStatisticsNextResults", resp, "Failure responding to next results request")
2718	}
2719	return
2720}
2721
2722// ListTableStatisticsComplete enumerates all values, automatically crossing page boundaries as required.
2723func (client Client) ListTableStatisticsComplete(ctx context.Context, accountName string, databaseName string, schemaName string, tableName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTableStatisticsListIterator, err error) {
2724	if tracing.IsEnabled() {
2725		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTableStatistics")
2726		defer func() {
2727			sc := -1
2728			if result.Response().Response.Response != nil {
2729				sc = result.page.Response().Response.Response.StatusCode
2730			}
2731			tracing.EndSpan(ctx, sc, err)
2732		}()
2733	}
2734	result.page, err = client.ListTableStatistics(ctx, accountName, databaseName, schemaName, tableName, filter, top, skip, expand, selectParameter, orderby, count)
2735	return
2736}
2737
2738// ListTableTypes retrieves the list of table types from the Data Lake Analytics catalog.
2739// Parameters:
2740// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
2741// databaseName - the name of the database containing the table types.
2742// schemaName - the name of the schema containing the table types.
2743// filter - oData filter. Optional.
2744// top - the number of items to return. Optional.
2745// skip - the number of items to skip over before returning elements. Optional.
2746// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
2747// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
2748// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
2749// Categories?$select=CategoryName,Description. Optional.
2750// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
2751// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
2752// Optional.
2753// count - the Boolean value of true or false to request a count of the matching resources included with the
2754// resources in the response, e.g. Categories?$count=true. Optional.
2755func (client Client) ListTableTypes(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTableTypeListPage, err error) {
2756	if tracing.IsEnabled() {
2757		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTableTypes")
2758		defer func() {
2759			sc := -1
2760			if result.uttl.Response.Response != nil {
2761				sc = result.uttl.Response.Response.StatusCode
2762			}
2763			tracing.EndSpan(ctx, sc, err)
2764		}()
2765	}
2766	result.fn = client.listTableTypesNextResults
2767	req, err := client.ListTableTypesPreparer(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
2768	if err != nil {
2769		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTableTypes", nil, "Failure preparing request")
2770		return
2771	}
2772
2773	resp, err := client.ListTableTypesSender(req)
2774	if err != nil {
2775		result.uttl.Response = autorest.Response{Response: resp}
2776		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTableTypes", resp, "Failure sending request")
2777		return
2778	}
2779
2780	result.uttl, err = client.ListTableTypesResponder(resp)
2781	if err != nil {
2782		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTableTypes", resp, "Failure responding to request")
2783	}
2784
2785	return
2786}
2787
2788// ListTableTypesPreparer prepares the ListTableTypes request.
2789func (client Client) ListTableTypesPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
2790	urlParameters := map[string]interface{}{
2791		"accountName":          accountName,
2792		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
2793	}
2794
2795	pathParameters := map[string]interface{}{
2796		"databaseName": autorest.Encode("path", databaseName),
2797		"schemaName":   autorest.Encode("path", schemaName),
2798	}
2799
2800	const APIVersion = "2015-10-01-preview"
2801	queryParameters := map[string]interface{}{
2802		"api-version": APIVersion,
2803	}
2804	if len(filter) > 0 {
2805		queryParameters["$filter"] = autorest.Encode("query", filter)
2806	}
2807	if top != nil {
2808		queryParameters["$top"] = autorest.Encode("query", *top)
2809	}
2810	if skip != nil {
2811		queryParameters["$skip"] = autorest.Encode("query", *skip)
2812	}
2813	if len(expand) > 0 {
2814		queryParameters["$expand"] = autorest.Encode("query", expand)
2815	}
2816	if len(selectParameter) > 0 {
2817		queryParameters["$select"] = autorest.Encode("query", selectParameter)
2818	}
2819	if len(orderby) > 0 {
2820		queryParameters["$orderby"] = autorest.Encode("query", orderby)
2821	}
2822	if count != nil {
2823		queryParameters["$count"] = autorest.Encode("query", *count)
2824	}
2825
2826	preparer := autorest.CreatePreparer(
2827		autorest.AsGet(),
2828		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
2829		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/tabletypes", pathParameters),
2830		autorest.WithQueryParameters(queryParameters))
2831	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2832}
2833
2834// ListTableTypesSender sends the ListTableTypes request. The method will close the
2835// http.Response Body if it receives an error.
2836func (client Client) ListTableTypesSender(req *http.Request) (*http.Response, error) {
2837	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2838	return autorest.SendWithSender(client, req, sd...)
2839}
2840
2841// ListTableTypesResponder handles the response to the ListTableTypes request. The method always
2842// closes the http.Response Body.
2843func (client Client) ListTableTypesResponder(resp *http.Response) (result USQLTableTypeList, err error) {
2844	err = autorest.Respond(
2845		resp,
2846		client.ByInspecting(),
2847		azure.WithErrorUnlessStatusCode(http.StatusOK),
2848		autorest.ByUnmarshallingJSON(&result),
2849		autorest.ByClosing())
2850	result.Response = autorest.Response{Response: resp}
2851	return
2852}
2853
2854// listTableTypesNextResults retrieves the next set of results, if any.
2855func (client Client) listTableTypesNextResults(ctx context.Context, lastResults USQLTableTypeList) (result USQLTableTypeList, err error) {
2856	req, err := lastResults.uSQLTableTypeListPreparer(ctx)
2857	if err != nil {
2858		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTableTypesNextResults", nil, "Failure preparing next results request")
2859	}
2860	if req == nil {
2861		return
2862	}
2863	resp, err := client.ListTableTypesSender(req)
2864	if err != nil {
2865		result.Response = autorest.Response{Response: resp}
2866		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTableTypesNextResults", resp, "Failure sending next results request")
2867	}
2868	result, err = client.ListTableTypesResponder(resp)
2869	if err != nil {
2870		err = autorest.NewErrorWithError(err, "catalog.Client", "listTableTypesNextResults", resp, "Failure responding to next results request")
2871	}
2872	return
2873}
2874
2875// ListTableTypesComplete enumerates all values, automatically crossing page boundaries as required.
2876func (client Client) ListTableTypesComplete(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTableTypeListIterator, err error) {
2877	if tracing.IsEnabled() {
2878		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTableTypes")
2879		defer func() {
2880			sc := -1
2881			if result.Response().Response.Response != nil {
2882				sc = result.page.Response().Response.Response.StatusCode
2883			}
2884			tracing.EndSpan(ctx, sc, err)
2885		}()
2886	}
2887	result.page, err = client.ListTableTypes(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
2888	return
2889}
2890
2891// ListTableValuedFunctions retrieves the list of table valued functions from the Data Lake Analytics catalog.
2892// Parameters:
2893// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
2894// databaseName - the name of the database containing the table valued functions.
2895// schemaName - the name of the schema containing the table valued functions.
2896// filter - oData filter. Optional.
2897// top - the number of items to return. Optional.
2898// skip - the number of items to skip over before returning elements. Optional.
2899// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
2900// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
2901// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
2902// Categories?$select=CategoryName,Description. Optional.
2903// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
2904// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
2905// Optional.
2906// count - the Boolean value of true or false to request a count of the matching resources included with the
2907// resources in the response, e.g. Categories?$count=true. Optional.
2908func (client Client) ListTableValuedFunctions(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTableValuedFunctionListPage, err error) {
2909	if tracing.IsEnabled() {
2910		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTableValuedFunctions")
2911		defer func() {
2912			sc := -1
2913			if result.utvfl.Response.Response != nil {
2914				sc = result.utvfl.Response.Response.StatusCode
2915			}
2916			tracing.EndSpan(ctx, sc, err)
2917		}()
2918	}
2919	result.fn = client.listTableValuedFunctionsNextResults
2920	req, err := client.ListTableValuedFunctionsPreparer(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
2921	if err != nil {
2922		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTableValuedFunctions", nil, "Failure preparing request")
2923		return
2924	}
2925
2926	resp, err := client.ListTableValuedFunctionsSender(req)
2927	if err != nil {
2928		result.utvfl.Response = autorest.Response{Response: resp}
2929		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTableValuedFunctions", resp, "Failure sending request")
2930		return
2931	}
2932
2933	result.utvfl, err = client.ListTableValuedFunctionsResponder(resp)
2934	if err != nil {
2935		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTableValuedFunctions", resp, "Failure responding to request")
2936	}
2937
2938	return
2939}
2940
2941// ListTableValuedFunctionsPreparer prepares the ListTableValuedFunctions request.
2942func (client Client) ListTableValuedFunctionsPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
2943	urlParameters := map[string]interface{}{
2944		"accountName":          accountName,
2945		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
2946	}
2947
2948	pathParameters := map[string]interface{}{
2949		"databaseName": autorest.Encode("path", databaseName),
2950		"schemaName":   autorest.Encode("path", schemaName),
2951	}
2952
2953	const APIVersion = "2015-10-01-preview"
2954	queryParameters := map[string]interface{}{
2955		"api-version": APIVersion,
2956	}
2957	if len(filter) > 0 {
2958		queryParameters["$filter"] = autorest.Encode("query", filter)
2959	}
2960	if top != nil {
2961		queryParameters["$top"] = autorest.Encode("query", *top)
2962	}
2963	if skip != nil {
2964		queryParameters["$skip"] = autorest.Encode("query", *skip)
2965	}
2966	if len(expand) > 0 {
2967		queryParameters["$expand"] = autorest.Encode("query", expand)
2968	}
2969	if len(selectParameter) > 0 {
2970		queryParameters["$select"] = autorest.Encode("query", selectParameter)
2971	}
2972	if len(orderby) > 0 {
2973		queryParameters["$orderby"] = autorest.Encode("query", orderby)
2974	}
2975	if count != nil {
2976		queryParameters["$count"] = autorest.Encode("query", *count)
2977	}
2978
2979	preparer := autorest.CreatePreparer(
2980		autorest.AsGet(),
2981		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
2982		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/tablevaluedfunctions", pathParameters),
2983		autorest.WithQueryParameters(queryParameters))
2984	return preparer.Prepare((&http.Request{}).WithContext(ctx))
2985}
2986
2987// ListTableValuedFunctionsSender sends the ListTableValuedFunctions request. The method will close the
2988// http.Response Body if it receives an error.
2989func (client Client) ListTableValuedFunctionsSender(req *http.Request) (*http.Response, error) {
2990	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2991	return autorest.SendWithSender(client, req, sd...)
2992}
2993
2994// ListTableValuedFunctionsResponder handles the response to the ListTableValuedFunctions request. The method always
2995// closes the http.Response Body.
2996func (client Client) ListTableValuedFunctionsResponder(resp *http.Response) (result USQLTableValuedFunctionList, err error) {
2997	err = autorest.Respond(
2998		resp,
2999		client.ByInspecting(),
3000		azure.WithErrorUnlessStatusCode(http.StatusOK),
3001		autorest.ByUnmarshallingJSON(&result),
3002		autorest.ByClosing())
3003	result.Response = autorest.Response{Response: resp}
3004	return
3005}
3006
3007// listTableValuedFunctionsNextResults retrieves the next set of results, if any.
3008func (client Client) listTableValuedFunctionsNextResults(ctx context.Context, lastResults USQLTableValuedFunctionList) (result USQLTableValuedFunctionList, err error) {
3009	req, err := lastResults.uSQLTableValuedFunctionListPreparer(ctx)
3010	if err != nil {
3011		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTableValuedFunctionsNextResults", nil, "Failure preparing next results request")
3012	}
3013	if req == nil {
3014		return
3015	}
3016	resp, err := client.ListTableValuedFunctionsSender(req)
3017	if err != nil {
3018		result.Response = autorest.Response{Response: resp}
3019		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTableValuedFunctionsNextResults", resp, "Failure sending next results request")
3020	}
3021	result, err = client.ListTableValuedFunctionsResponder(resp)
3022	if err != nil {
3023		err = autorest.NewErrorWithError(err, "catalog.Client", "listTableValuedFunctionsNextResults", resp, "Failure responding to next results request")
3024	}
3025	return
3026}
3027
3028// ListTableValuedFunctionsComplete enumerates all values, automatically crossing page boundaries as required.
3029func (client Client) ListTableValuedFunctionsComplete(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTableValuedFunctionListIterator, err error) {
3030	if tracing.IsEnabled() {
3031		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTableValuedFunctions")
3032		defer func() {
3033			sc := -1
3034			if result.Response().Response.Response != nil {
3035				sc = result.page.Response().Response.Response.StatusCode
3036			}
3037			tracing.EndSpan(ctx, sc, err)
3038		}()
3039	}
3040	result.page, err = client.ListTableValuedFunctions(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
3041	return
3042}
3043
3044// ListTypes retrieves the list of types within the specified database and schema from the Data Lake Analytics catalog.
3045// Parameters:
3046// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
3047// databaseName - the name of the database containing the types.
3048// schemaName - the name of the schema containing the types.
3049// filter - oData filter. Optional.
3050// top - the number of items to return. Optional.
3051// skip - the number of items to skip over before returning elements. Optional.
3052// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
3053// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
3054// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
3055// Categories?$select=CategoryName,Description. Optional.
3056// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
3057// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
3058// Optional.
3059// count - the Boolean value of true or false to request a count of the matching resources included with the
3060// resources in the response, e.g. Categories?$count=true. Optional.
3061func (client Client) ListTypes(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTypeListPage, err error) {
3062	if tracing.IsEnabled() {
3063		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTypes")
3064		defer func() {
3065			sc := -1
3066			if result.utl.Response.Response != nil {
3067				sc = result.utl.Response.Response.StatusCode
3068			}
3069			tracing.EndSpan(ctx, sc, err)
3070		}()
3071	}
3072	result.fn = client.listTypesNextResults
3073	req, err := client.ListTypesPreparer(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
3074	if err != nil {
3075		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTypes", nil, "Failure preparing request")
3076		return
3077	}
3078
3079	resp, err := client.ListTypesSender(req)
3080	if err != nil {
3081		result.utl.Response = autorest.Response{Response: resp}
3082		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTypes", resp, "Failure sending request")
3083		return
3084	}
3085
3086	result.utl, err = client.ListTypesResponder(resp)
3087	if err != nil {
3088		err = autorest.NewErrorWithError(err, "catalog.Client", "ListTypes", resp, "Failure responding to request")
3089	}
3090
3091	return
3092}
3093
3094// ListTypesPreparer prepares the ListTypes request.
3095func (client Client) ListTypesPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
3096	urlParameters := map[string]interface{}{
3097		"accountName":          accountName,
3098		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
3099	}
3100
3101	pathParameters := map[string]interface{}{
3102		"databaseName": autorest.Encode("path", databaseName),
3103		"schemaName":   autorest.Encode("path", schemaName),
3104	}
3105
3106	const APIVersion = "2015-10-01-preview"
3107	queryParameters := map[string]interface{}{
3108		"api-version": APIVersion,
3109	}
3110	if len(filter) > 0 {
3111		queryParameters["$filter"] = autorest.Encode("query", filter)
3112	}
3113	if top != nil {
3114		queryParameters["$top"] = autorest.Encode("query", *top)
3115	}
3116	if skip != nil {
3117		queryParameters["$skip"] = autorest.Encode("query", *skip)
3118	}
3119	if len(expand) > 0 {
3120		queryParameters["$expand"] = autorest.Encode("query", expand)
3121	}
3122	if len(selectParameter) > 0 {
3123		queryParameters["$select"] = autorest.Encode("query", selectParameter)
3124	}
3125	if len(orderby) > 0 {
3126		queryParameters["$orderby"] = autorest.Encode("query", orderby)
3127	}
3128	if count != nil {
3129		queryParameters["$count"] = autorest.Encode("query", *count)
3130	}
3131
3132	preparer := autorest.CreatePreparer(
3133		autorest.AsGet(),
3134		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
3135		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/types", pathParameters),
3136		autorest.WithQueryParameters(queryParameters))
3137	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3138}
3139
3140// ListTypesSender sends the ListTypes request. The method will close the
3141// http.Response Body if it receives an error.
3142func (client Client) ListTypesSender(req *http.Request) (*http.Response, error) {
3143	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3144	return autorest.SendWithSender(client, req, sd...)
3145}
3146
3147// ListTypesResponder handles the response to the ListTypes request. The method always
3148// closes the http.Response Body.
3149func (client Client) ListTypesResponder(resp *http.Response) (result USQLTypeList, err error) {
3150	err = autorest.Respond(
3151		resp,
3152		client.ByInspecting(),
3153		azure.WithErrorUnlessStatusCode(http.StatusOK),
3154		autorest.ByUnmarshallingJSON(&result),
3155		autorest.ByClosing())
3156	result.Response = autorest.Response{Response: resp}
3157	return
3158}
3159
3160// listTypesNextResults retrieves the next set of results, if any.
3161func (client Client) listTypesNextResults(ctx context.Context, lastResults USQLTypeList) (result USQLTypeList, err error) {
3162	req, err := lastResults.uSQLTypeListPreparer(ctx)
3163	if err != nil {
3164		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTypesNextResults", nil, "Failure preparing next results request")
3165	}
3166	if req == nil {
3167		return
3168	}
3169	resp, err := client.ListTypesSender(req)
3170	if err != nil {
3171		result.Response = autorest.Response{Response: resp}
3172		return result, autorest.NewErrorWithError(err, "catalog.Client", "listTypesNextResults", resp, "Failure sending next results request")
3173	}
3174	result, err = client.ListTypesResponder(resp)
3175	if err != nil {
3176		err = autorest.NewErrorWithError(err, "catalog.Client", "listTypesNextResults", resp, "Failure responding to next results request")
3177	}
3178	return
3179}
3180
3181// ListTypesComplete enumerates all values, automatically crossing page boundaries as required.
3182func (client Client) ListTypesComplete(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLTypeListIterator, err error) {
3183	if tracing.IsEnabled() {
3184		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListTypes")
3185		defer func() {
3186			sc := -1
3187			if result.Response().Response.Response != nil {
3188				sc = result.page.Response().Response.Response.StatusCode
3189			}
3190			tracing.EndSpan(ctx, sc, err)
3191		}()
3192	}
3193	result.page, err = client.ListTypes(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
3194	return
3195}
3196
3197// ListViews retrieves the list of views from the Data Lake Analytics catalog.
3198// Parameters:
3199// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
3200// databaseName - the name of the database containing the views.
3201// schemaName - the name of the schema containing the views.
3202// filter - oData filter. Optional.
3203// top - the number of items to return. Optional.
3204// skip - the number of items to skip over before returning elements. Optional.
3205// expand - oData expansion. Expand related resources in line with the retrieved resources, e.g.
3206// Categories?$expand=Products would expand Product data in line with each Category entry. Optional.
3207// selectParameter - oData Select statement. Limits the properties on each entry to just those requested, e.g.
3208// Categories?$select=CategoryName,Description. Optional.
3209// orderby - orderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or
3210// "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc.
3211// Optional.
3212// count - the Boolean value of true or false to request a count of the matching resources included with the
3213// resources in the response, e.g. Categories?$count=true. Optional.
3214func (client Client) ListViews(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLViewListPage, err error) {
3215	if tracing.IsEnabled() {
3216		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListViews")
3217		defer func() {
3218			sc := -1
3219			if result.uvl.Response.Response != nil {
3220				sc = result.uvl.Response.Response.StatusCode
3221			}
3222			tracing.EndSpan(ctx, sc, err)
3223		}()
3224	}
3225	result.fn = client.listViewsNextResults
3226	req, err := client.ListViewsPreparer(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
3227	if err != nil {
3228		err = autorest.NewErrorWithError(err, "catalog.Client", "ListViews", nil, "Failure preparing request")
3229		return
3230	}
3231
3232	resp, err := client.ListViewsSender(req)
3233	if err != nil {
3234		result.uvl.Response = autorest.Response{Response: resp}
3235		err = autorest.NewErrorWithError(err, "catalog.Client", "ListViews", resp, "Failure sending request")
3236		return
3237	}
3238
3239	result.uvl, err = client.ListViewsResponder(resp)
3240	if err != nil {
3241		err = autorest.NewErrorWithError(err, "catalog.Client", "ListViews", resp, "Failure responding to request")
3242	}
3243
3244	return
3245}
3246
3247// ListViewsPreparer prepares the ListViews request.
3248func (client Client) ListViewsPreparer(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (*http.Request, error) {
3249	urlParameters := map[string]interface{}{
3250		"accountName":          accountName,
3251		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
3252	}
3253
3254	pathParameters := map[string]interface{}{
3255		"databaseName": autorest.Encode("path", databaseName),
3256		"schemaName":   autorest.Encode("path", schemaName),
3257	}
3258
3259	const APIVersion = "2015-10-01-preview"
3260	queryParameters := map[string]interface{}{
3261		"api-version": APIVersion,
3262	}
3263	if len(filter) > 0 {
3264		queryParameters["$filter"] = autorest.Encode("query", filter)
3265	}
3266	if top != nil {
3267		queryParameters["$top"] = autorest.Encode("query", *top)
3268	}
3269	if skip != nil {
3270		queryParameters["$skip"] = autorest.Encode("query", *skip)
3271	}
3272	if len(expand) > 0 {
3273		queryParameters["$expand"] = autorest.Encode("query", expand)
3274	}
3275	if len(selectParameter) > 0 {
3276		queryParameters["$select"] = autorest.Encode("query", selectParameter)
3277	}
3278	if len(orderby) > 0 {
3279		queryParameters["$orderby"] = autorest.Encode("query", orderby)
3280	}
3281	if count != nil {
3282		queryParameters["$count"] = autorest.Encode("query", *count)
3283	}
3284
3285	preparer := autorest.CreatePreparer(
3286		autorest.AsGet(),
3287		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
3288		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/schemas/{schemaName}/views", pathParameters),
3289		autorest.WithQueryParameters(queryParameters))
3290	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3291}
3292
3293// ListViewsSender sends the ListViews request. The method will close the
3294// http.Response Body if it receives an error.
3295func (client Client) ListViewsSender(req *http.Request) (*http.Response, error) {
3296	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3297	return autorest.SendWithSender(client, req, sd...)
3298}
3299
3300// ListViewsResponder handles the response to the ListViews request. The method always
3301// closes the http.Response Body.
3302func (client Client) ListViewsResponder(resp *http.Response) (result USQLViewList, err error) {
3303	err = autorest.Respond(
3304		resp,
3305		client.ByInspecting(),
3306		azure.WithErrorUnlessStatusCode(http.StatusOK),
3307		autorest.ByUnmarshallingJSON(&result),
3308		autorest.ByClosing())
3309	result.Response = autorest.Response{Response: resp}
3310	return
3311}
3312
3313// listViewsNextResults retrieves the next set of results, if any.
3314func (client Client) listViewsNextResults(ctx context.Context, lastResults USQLViewList) (result USQLViewList, err error) {
3315	req, err := lastResults.uSQLViewListPreparer(ctx)
3316	if err != nil {
3317		return result, autorest.NewErrorWithError(err, "catalog.Client", "listViewsNextResults", nil, "Failure preparing next results request")
3318	}
3319	if req == nil {
3320		return
3321	}
3322	resp, err := client.ListViewsSender(req)
3323	if err != nil {
3324		result.Response = autorest.Response{Response: resp}
3325		return result, autorest.NewErrorWithError(err, "catalog.Client", "listViewsNextResults", resp, "Failure sending next results request")
3326	}
3327	result, err = client.ListViewsResponder(resp)
3328	if err != nil {
3329		err = autorest.NewErrorWithError(err, "catalog.Client", "listViewsNextResults", resp, "Failure responding to next results request")
3330	}
3331	return
3332}
3333
3334// ListViewsComplete enumerates all values, automatically crossing page boundaries as required.
3335func (client Client) ListViewsComplete(ctx context.Context, accountName string, databaseName string, schemaName string, filter string, top *int32, skip *int32, expand string, selectParameter string, orderby string, count *bool) (result USQLViewListIterator, err error) {
3336	if tracing.IsEnabled() {
3337		ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListViews")
3338		defer func() {
3339			sc := -1
3340			if result.Response().Response.Response != nil {
3341				sc = result.page.Response().Response.Response.StatusCode
3342			}
3343			tracing.EndSpan(ctx, sc, err)
3344		}()
3345	}
3346	result.page, err = client.ListViews(ctx, accountName, databaseName, schemaName, filter, top, skip, expand, selectParameter, orderby, count)
3347	return
3348}
3349
3350// UpdateSecret modifies the specified secret for use with external data sources in the specified database
3351// Parameters:
3352// accountName - the Azure Data Lake Analytics account to execute catalog operations on.
3353// databaseName - the name of the database containing the secret.
3354// secretName - the name of the secret.
3355// parameters - the parameters required to modify the secret (name and password)
3356func (client Client) UpdateSecret(ctx context.Context, accountName string, databaseName string, secretName string, parameters DataLakeAnalyticsCatalogSecretCreateOrUpdateParameters) (result USQLSecret, err error) {
3357	if tracing.IsEnabled() {
3358		ctx = tracing.StartSpan(ctx, fqdn+"/Client.UpdateSecret")
3359		defer func() {
3360			sc := -1
3361			if result.Response.Response != nil {
3362				sc = result.Response.Response.StatusCode
3363			}
3364			tracing.EndSpan(ctx, sc, err)
3365		}()
3366	}
3367	req, err := client.UpdateSecretPreparer(ctx, accountName, databaseName, secretName, parameters)
3368	if err != nil {
3369		err = autorest.NewErrorWithError(err, "catalog.Client", "UpdateSecret", nil, "Failure preparing request")
3370		return
3371	}
3372
3373	resp, err := client.UpdateSecretSender(req)
3374	if err != nil {
3375		result.Response = autorest.Response{Response: resp}
3376		err = autorest.NewErrorWithError(err, "catalog.Client", "UpdateSecret", resp, "Failure sending request")
3377		return
3378	}
3379
3380	result, err = client.UpdateSecretResponder(resp)
3381	if err != nil {
3382		err = autorest.NewErrorWithError(err, "catalog.Client", "UpdateSecret", resp, "Failure responding to request")
3383	}
3384
3385	return
3386}
3387
3388// UpdateSecretPreparer prepares the UpdateSecret request.
3389func (client Client) UpdateSecretPreparer(ctx context.Context, accountName string, databaseName string, secretName string, parameters DataLakeAnalyticsCatalogSecretCreateOrUpdateParameters) (*http.Request, error) {
3390	urlParameters := map[string]interface{}{
3391		"accountName":          accountName,
3392		"adlaCatalogDnsSuffix": client.AdlaCatalogDNSSuffix,
3393	}
3394
3395	pathParameters := map[string]interface{}{
3396		"databaseName": autorest.Encode("path", databaseName),
3397		"secretName":   autorest.Encode("path", secretName),
3398	}
3399
3400	const APIVersion = "2015-10-01-preview"
3401	queryParameters := map[string]interface{}{
3402		"api-version": APIVersion,
3403	}
3404
3405	preparer := autorest.CreatePreparer(
3406		autorest.AsContentType("application/json; charset=utf-8"),
3407		autorest.AsPatch(),
3408		autorest.WithCustomBaseURL("https://{accountName}.{adlaCatalogDnsSuffix}", urlParameters),
3409		autorest.WithPathParameters("/catalog/usql/databases/{databaseName}/secrets/{secretName}", pathParameters),
3410		autorest.WithJSON(parameters),
3411		autorest.WithQueryParameters(queryParameters))
3412	return preparer.Prepare((&http.Request{}).WithContext(ctx))
3413}
3414
3415// UpdateSecretSender sends the UpdateSecret request. The method will close the
3416// http.Response Body if it receives an error.
3417func (client Client) UpdateSecretSender(req *http.Request) (*http.Response, error) {
3418	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
3419	return autorest.SendWithSender(client, req, sd...)
3420}
3421
3422// UpdateSecretResponder handles the response to the UpdateSecret request. The method always
3423// closes the http.Response Body.
3424func (client Client) UpdateSecretResponder(resp *http.Response) (result USQLSecret, err error) {
3425	err = autorest.Respond(
3426		resp,
3427		client.ByInspecting(),
3428		azure.WithErrorUnlessStatusCode(http.StatusOK),
3429		autorest.ByUnmarshallingJSON(&result),
3430		autorest.ByClosing())
3431	result.Response = autorest.Response{Response: resp}
3432	return
3433}
3434