1package datafactory
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"github.com/Azure/go-autorest/autorest"
12	"github.com/Azure/go-autorest/autorest/azure"
13	"github.com/Azure/go-autorest/autorest/validation"
14	"github.com/Azure/go-autorest/tracing"
15	"net/http"
16)
17
18// DataFlowDebugSessionClient is the the Azure Data Factory V2 management API provides a RESTful set of web services
19// that interact with Azure Data Factory V2 services.
20type DataFlowDebugSessionClient struct {
21	BaseClient
22}
23
24// NewDataFlowDebugSessionClient creates an instance of the DataFlowDebugSessionClient client.
25func NewDataFlowDebugSessionClient(subscriptionID string) DataFlowDebugSessionClient {
26	return NewDataFlowDebugSessionClientWithBaseURI(DefaultBaseURI, subscriptionID)
27}
28
29// NewDataFlowDebugSessionClientWithBaseURI creates an instance of the DataFlowDebugSessionClient client using a custom
30// endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure
31// stack).
32func NewDataFlowDebugSessionClientWithBaseURI(baseURI string, subscriptionID string) DataFlowDebugSessionClient {
33	return DataFlowDebugSessionClient{NewWithBaseURI(baseURI, subscriptionID)}
34}
35
36// AddDataFlow add a data flow into debug session.
37// Parameters:
38// resourceGroupName - the resource group name.
39// factoryName - the factory name.
40// request - data flow debug session definition with debug content.
41func (client DataFlowDebugSessionClient) AddDataFlow(ctx context.Context, resourceGroupName string, factoryName string, request DataFlowDebugPackage) (result AddDataFlowToDebugSessionResponse, err error) {
42	if tracing.IsEnabled() {
43		ctx = tracing.StartSpan(ctx, fqdn+"/DataFlowDebugSessionClient.AddDataFlow")
44		defer func() {
45			sc := -1
46			if result.Response.Response != nil {
47				sc = result.Response.Response.StatusCode
48			}
49			tracing.EndSpan(ctx, sc, err)
50		}()
51	}
52	if err := validation.Validate([]validation.Validation{
53		{TargetValue: resourceGroupName,
54			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
55				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
56				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
57		{TargetValue: factoryName,
58			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
59				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
60				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
61		{TargetValue: request,
62			Constraints: []validation.Constraint{{Target: "request.Staging", Name: validation.Null, Rule: false,
63				Chain: []validation.Constraint{{Target: "request.Staging.LinkedService", Name: validation.Null, Rule: false,
64					Chain: []validation.Constraint{{Target: "request.Staging.LinkedService.Type", Name: validation.Null, Rule: true, Chain: nil},
65						{Target: "request.Staging.LinkedService.ReferenceName", Name: validation.Null, Rule: true, Chain: nil},
66					}},
67				}}}}}); err != nil {
68		return result, validation.NewError("datafactory.DataFlowDebugSessionClient", "AddDataFlow", err.Error())
69	}
70
71	req, err := client.AddDataFlowPreparer(ctx, resourceGroupName, factoryName, request)
72	if err != nil {
73		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "AddDataFlow", nil, "Failure preparing request")
74		return
75	}
76
77	resp, err := client.AddDataFlowSender(req)
78	if err != nil {
79		result.Response = autorest.Response{Response: resp}
80		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "AddDataFlow", resp, "Failure sending request")
81		return
82	}
83
84	result, err = client.AddDataFlowResponder(resp)
85	if err != nil {
86		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "AddDataFlow", resp, "Failure responding to request")
87		return
88	}
89
90	return
91}
92
93// AddDataFlowPreparer prepares the AddDataFlow request.
94func (client DataFlowDebugSessionClient) AddDataFlowPreparer(ctx context.Context, resourceGroupName string, factoryName string, request DataFlowDebugPackage) (*http.Request, error) {
95	pathParameters := map[string]interface{}{
96		"factoryName":       autorest.Encode("path", factoryName),
97		"resourceGroupName": autorest.Encode("path", resourceGroupName),
98		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
99	}
100
101	const APIVersion = "2018-06-01"
102	queryParameters := map[string]interface{}{
103		"api-version": APIVersion,
104	}
105
106	preparer := autorest.CreatePreparer(
107		autorest.AsContentType("application/json; charset=utf-8"),
108		autorest.AsPost(),
109		autorest.WithBaseURL(client.BaseURI),
110		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/addDataFlowToDebugSession", pathParameters),
111		autorest.WithJSON(request),
112		autorest.WithQueryParameters(queryParameters))
113	return preparer.Prepare((&http.Request{}).WithContext(ctx))
114}
115
116// AddDataFlowSender sends the AddDataFlow request. The method will close the
117// http.Response Body if it receives an error.
118func (client DataFlowDebugSessionClient) AddDataFlowSender(req *http.Request) (*http.Response, error) {
119	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
120}
121
122// AddDataFlowResponder handles the response to the AddDataFlow request. The method always
123// closes the http.Response Body.
124func (client DataFlowDebugSessionClient) AddDataFlowResponder(resp *http.Response) (result AddDataFlowToDebugSessionResponse, err error) {
125	err = autorest.Respond(
126		resp,
127		azure.WithErrorUnlessStatusCode(http.StatusOK),
128		autorest.ByUnmarshallingJSON(&result),
129		autorest.ByClosing())
130	result.Response = autorest.Response{Response: resp}
131	return
132}
133
134// Create creates a data flow debug session.
135// Parameters:
136// resourceGroupName - the resource group name.
137// factoryName - the factory name.
138// request - data flow debug session definition
139func (client DataFlowDebugSessionClient) Create(ctx context.Context, resourceGroupName string, factoryName string, request CreateDataFlowDebugSessionRequest) (result DataFlowDebugSessionCreateFuture, err error) {
140	if tracing.IsEnabled() {
141		ctx = tracing.StartSpan(ctx, fqdn+"/DataFlowDebugSessionClient.Create")
142		defer func() {
143			sc := -1
144			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
145				sc = result.FutureAPI.Response().StatusCode
146			}
147			tracing.EndSpan(ctx, sc, err)
148		}()
149	}
150	if err := validation.Validate([]validation.Validation{
151		{TargetValue: resourceGroupName,
152			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
153				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
154				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
155		{TargetValue: factoryName,
156			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
157				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
158				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
159		return result, validation.NewError("datafactory.DataFlowDebugSessionClient", "Create", err.Error())
160	}
161
162	req, err := client.CreatePreparer(ctx, resourceGroupName, factoryName, request)
163	if err != nil {
164		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "Create", nil, "Failure preparing request")
165		return
166	}
167
168	result, err = client.CreateSender(req)
169	if err != nil {
170		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "Create", nil, "Failure sending request")
171		return
172	}
173
174	return
175}
176
177// CreatePreparer prepares the Create request.
178func (client DataFlowDebugSessionClient) CreatePreparer(ctx context.Context, resourceGroupName string, factoryName string, request CreateDataFlowDebugSessionRequest) (*http.Request, error) {
179	pathParameters := map[string]interface{}{
180		"factoryName":       autorest.Encode("path", factoryName),
181		"resourceGroupName": autorest.Encode("path", resourceGroupName),
182		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
183	}
184
185	const APIVersion = "2018-06-01"
186	queryParameters := map[string]interface{}{
187		"api-version": APIVersion,
188	}
189
190	preparer := autorest.CreatePreparer(
191		autorest.AsContentType("application/json; charset=utf-8"),
192		autorest.AsPost(),
193		autorest.WithBaseURL(client.BaseURI),
194		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/createDataFlowDebugSession", pathParameters),
195		autorest.WithJSON(request),
196		autorest.WithQueryParameters(queryParameters))
197	return preparer.Prepare((&http.Request{}).WithContext(ctx))
198}
199
200// CreateSender sends the Create request. The method will close the
201// http.Response Body if it receives an error.
202func (client DataFlowDebugSessionClient) CreateSender(req *http.Request) (future DataFlowDebugSessionCreateFuture, err error) {
203	var resp *http.Response
204	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
205	if err != nil {
206		return
207	}
208	var azf azure.Future
209	azf, err = azure.NewFutureFromResponse(resp)
210	future.FutureAPI = &azf
211	future.Result = future.result
212	return
213}
214
215// CreateResponder handles the response to the Create request. The method always
216// closes the http.Response Body.
217func (client DataFlowDebugSessionClient) CreateResponder(resp *http.Response) (result CreateDataFlowDebugSessionResponse, err error) {
218	err = autorest.Respond(
219		resp,
220		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
221		autorest.ByUnmarshallingJSON(&result),
222		autorest.ByClosing())
223	result.Response = autorest.Response{Response: resp}
224	return
225}
226
227// Delete deletes a data flow debug session.
228// Parameters:
229// resourceGroupName - the resource group name.
230// factoryName - the factory name.
231// request - data flow debug session definition for deletion
232func (client DataFlowDebugSessionClient) Delete(ctx context.Context, resourceGroupName string, factoryName string, request DeleteDataFlowDebugSessionRequest) (result autorest.Response, err error) {
233	if tracing.IsEnabled() {
234		ctx = tracing.StartSpan(ctx, fqdn+"/DataFlowDebugSessionClient.Delete")
235		defer func() {
236			sc := -1
237			if result.Response != nil {
238				sc = result.Response.StatusCode
239			}
240			tracing.EndSpan(ctx, sc, err)
241		}()
242	}
243	if err := validation.Validate([]validation.Validation{
244		{TargetValue: resourceGroupName,
245			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
246				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
247				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
248		{TargetValue: factoryName,
249			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
250				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
251				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
252		return result, validation.NewError("datafactory.DataFlowDebugSessionClient", "Delete", err.Error())
253	}
254
255	req, err := client.DeletePreparer(ctx, resourceGroupName, factoryName, request)
256	if err != nil {
257		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "Delete", nil, "Failure preparing request")
258		return
259	}
260
261	resp, err := client.DeleteSender(req)
262	if err != nil {
263		result.Response = resp
264		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "Delete", resp, "Failure sending request")
265		return
266	}
267
268	result, err = client.DeleteResponder(resp)
269	if err != nil {
270		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "Delete", resp, "Failure responding to request")
271		return
272	}
273
274	return
275}
276
277// DeletePreparer prepares the Delete request.
278func (client DataFlowDebugSessionClient) DeletePreparer(ctx context.Context, resourceGroupName string, factoryName string, request DeleteDataFlowDebugSessionRequest) (*http.Request, error) {
279	pathParameters := map[string]interface{}{
280		"factoryName":       autorest.Encode("path", factoryName),
281		"resourceGroupName": autorest.Encode("path", resourceGroupName),
282		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
283	}
284
285	const APIVersion = "2018-06-01"
286	queryParameters := map[string]interface{}{
287		"api-version": APIVersion,
288	}
289
290	preparer := autorest.CreatePreparer(
291		autorest.AsContentType("application/json; charset=utf-8"),
292		autorest.AsPost(),
293		autorest.WithBaseURL(client.BaseURI),
294		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/deleteDataFlowDebugSession", pathParameters),
295		autorest.WithJSON(request),
296		autorest.WithQueryParameters(queryParameters))
297	return preparer.Prepare((&http.Request{}).WithContext(ctx))
298}
299
300// DeleteSender sends the Delete request. The method will close the
301// http.Response Body if it receives an error.
302func (client DataFlowDebugSessionClient) DeleteSender(req *http.Request) (*http.Response, error) {
303	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
304}
305
306// DeleteResponder handles the response to the Delete request. The method always
307// closes the http.Response Body.
308func (client DataFlowDebugSessionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
309	err = autorest.Respond(
310		resp,
311		azure.WithErrorUnlessStatusCode(http.StatusOK),
312		autorest.ByClosing())
313	result.Response = resp
314	return
315}
316
317// ExecuteCommand execute a data flow debug command.
318// Parameters:
319// resourceGroupName - the resource group name.
320// factoryName - the factory name.
321// request - data flow debug command definition.
322func (client DataFlowDebugSessionClient) ExecuteCommand(ctx context.Context, resourceGroupName string, factoryName string, request DataFlowDebugCommandRequest) (result DataFlowDebugSessionExecuteCommandFuture, err error) {
323	if tracing.IsEnabled() {
324		ctx = tracing.StartSpan(ctx, fqdn+"/DataFlowDebugSessionClient.ExecuteCommand")
325		defer func() {
326			sc := -1
327			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
328				sc = result.FutureAPI.Response().StatusCode
329			}
330			tracing.EndSpan(ctx, sc, err)
331		}()
332	}
333	if err := validation.Validate([]validation.Validation{
334		{TargetValue: resourceGroupName,
335			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
336				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
337				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
338		{TargetValue: factoryName,
339			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
340				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
341				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
342		{TargetValue: request,
343			Constraints: []validation.Constraint{{Target: "request.CommandPayload", Name: validation.Null, Rule: false,
344				Chain: []validation.Constraint{{Target: "request.CommandPayload.StreamName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
345		return result, validation.NewError("datafactory.DataFlowDebugSessionClient", "ExecuteCommand", err.Error())
346	}
347
348	req, err := client.ExecuteCommandPreparer(ctx, resourceGroupName, factoryName, request)
349	if err != nil {
350		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "ExecuteCommand", nil, "Failure preparing request")
351		return
352	}
353
354	result, err = client.ExecuteCommandSender(req)
355	if err != nil {
356		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "ExecuteCommand", nil, "Failure sending request")
357		return
358	}
359
360	return
361}
362
363// ExecuteCommandPreparer prepares the ExecuteCommand request.
364func (client DataFlowDebugSessionClient) ExecuteCommandPreparer(ctx context.Context, resourceGroupName string, factoryName string, request DataFlowDebugCommandRequest) (*http.Request, error) {
365	pathParameters := map[string]interface{}{
366		"factoryName":       autorest.Encode("path", factoryName),
367		"resourceGroupName": autorest.Encode("path", resourceGroupName),
368		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
369	}
370
371	const APIVersion = "2018-06-01"
372	queryParameters := map[string]interface{}{
373		"api-version": APIVersion,
374	}
375
376	preparer := autorest.CreatePreparer(
377		autorest.AsContentType("application/json; charset=utf-8"),
378		autorest.AsPost(),
379		autorest.WithBaseURL(client.BaseURI),
380		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/executeDataFlowDebugCommand", pathParameters),
381		autorest.WithJSON(request),
382		autorest.WithQueryParameters(queryParameters))
383	return preparer.Prepare((&http.Request{}).WithContext(ctx))
384}
385
386// ExecuteCommandSender sends the ExecuteCommand request. The method will close the
387// http.Response Body if it receives an error.
388func (client DataFlowDebugSessionClient) ExecuteCommandSender(req *http.Request) (future DataFlowDebugSessionExecuteCommandFuture, err error) {
389	var resp *http.Response
390	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
391	if err != nil {
392		return
393	}
394	var azf azure.Future
395	azf, err = azure.NewFutureFromResponse(resp)
396	future.FutureAPI = &azf
397	future.Result = future.result
398	return
399}
400
401// ExecuteCommandResponder handles the response to the ExecuteCommand request. The method always
402// closes the http.Response Body.
403func (client DataFlowDebugSessionClient) ExecuteCommandResponder(resp *http.Response) (result DataFlowDebugCommandResponse, err error) {
404	err = autorest.Respond(
405		resp,
406		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
407		autorest.ByUnmarshallingJSON(&result),
408		autorest.ByClosing())
409	result.Response = autorest.Response{Response: resp}
410	return
411}
412
413// QueryByFactory query all active data flow debug sessions.
414// Parameters:
415// resourceGroupName - the resource group name.
416// factoryName - the factory name.
417func (client DataFlowDebugSessionClient) QueryByFactory(ctx context.Context, resourceGroupName string, factoryName string) (result QueryDataFlowDebugSessionsResponsePage, err error) {
418	if tracing.IsEnabled() {
419		ctx = tracing.StartSpan(ctx, fqdn+"/DataFlowDebugSessionClient.QueryByFactory")
420		defer func() {
421			sc := -1
422			if result.qdfdsr.Response.Response != nil {
423				sc = result.qdfdsr.Response.Response.StatusCode
424			}
425			tracing.EndSpan(ctx, sc, err)
426		}()
427	}
428	if err := validation.Validate([]validation.Validation{
429		{TargetValue: resourceGroupName,
430			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
431				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
432				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
433		{TargetValue: factoryName,
434			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
435				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
436				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
437		return result, validation.NewError("datafactory.DataFlowDebugSessionClient", "QueryByFactory", err.Error())
438	}
439
440	result.fn = client.queryByFactoryNextResults
441	req, err := client.QueryByFactoryPreparer(ctx, resourceGroupName, factoryName)
442	if err != nil {
443		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "QueryByFactory", nil, "Failure preparing request")
444		return
445	}
446
447	resp, err := client.QueryByFactorySender(req)
448	if err != nil {
449		result.qdfdsr.Response = autorest.Response{Response: resp}
450		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "QueryByFactory", resp, "Failure sending request")
451		return
452	}
453
454	result.qdfdsr, err = client.QueryByFactoryResponder(resp)
455	if err != nil {
456		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "QueryByFactory", resp, "Failure responding to request")
457		return
458	}
459	if result.qdfdsr.hasNextLink() && result.qdfdsr.IsEmpty() {
460		err = result.NextWithContext(ctx)
461		return
462	}
463
464	return
465}
466
467// QueryByFactoryPreparer prepares the QueryByFactory request.
468func (client DataFlowDebugSessionClient) QueryByFactoryPreparer(ctx context.Context, resourceGroupName string, factoryName string) (*http.Request, error) {
469	pathParameters := map[string]interface{}{
470		"factoryName":       autorest.Encode("path", factoryName),
471		"resourceGroupName": autorest.Encode("path", resourceGroupName),
472		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
473	}
474
475	const APIVersion = "2018-06-01"
476	queryParameters := map[string]interface{}{
477		"api-version": APIVersion,
478	}
479
480	preparer := autorest.CreatePreparer(
481		autorest.AsPost(),
482		autorest.WithBaseURL(client.BaseURI),
483		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/queryDataFlowDebugSessions", pathParameters),
484		autorest.WithQueryParameters(queryParameters))
485	return preparer.Prepare((&http.Request{}).WithContext(ctx))
486}
487
488// QueryByFactorySender sends the QueryByFactory request. The method will close the
489// http.Response Body if it receives an error.
490func (client DataFlowDebugSessionClient) QueryByFactorySender(req *http.Request) (*http.Response, error) {
491	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
492}
493
494// QueryByFactoryResponder handles the response to the QueryByFactory request. The method always
495// closes the http.Response Body.
496func (client DataFlowDebugSessionClient) QueryByFactoryResponder(resp *http.Response) (result QueryDataFlowDebugSessionsResponse, err error) {
497	err = autorest.Respond(
498		resp,
499		azure.WithErrorUnlessStatusCode(http.StatusOK),
500		autorest.ByUnmarshallingJSON(&result),
501		autorest.ByClosing())
502	result.Response = autorest.Response{Response: resp}
503	return
504}
505
506// queryByFactoryNextResults retrieves the next set of results, if any.
507func (client DataFlowDebugSessionClient) queryByFactoryNextResults(ctx context.Context, lastResults QueryDataFlowDebugSessionsResponse) (result QueryDataFlowDebugSessionsResponse, err error) {
508	req, err := lastResults.queryDataFlowDebugSessionsResponsePreparer(ctx)
509	if err != nil {
510		return result, autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "queryByFactoryNextResults", nil, "Failure preparing next results request")
511	}
512	if req == nil {
513		return
514	}
515	resp, err := client.QueryByFactorySender(req)
516	if err != nil {
517		result.Response = autorest.Response{Response: resp}
518		return result, autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "queryByFactoryNextResults", resp, "Failure sending next results request")
519	}
520	result, err = client.QueryByFactoryResponder(resp)
521	if err != nil {
522		err = autorest.NewErrorWithError(err, "datafactory.DataFlowDebugSessionClient", "queryByFactoryNextResults", resp, "Failure responding to next results request")
523	}
524	return
525}
526
527// QueryByFactoryComplete enumerates all values, automatically crossing page boundaries as required.
528func (client DataFlowDebugSessionClient) QueryByFactoryComplete(ctx context.Context, resourceGroupName string, factoryName string) (result QueryDataFlowDebugSessionsResponseIterator, err error) {
529	if tracing.IsEnabled() {
530		ctx = tracing.StartSpan(ctx, fqdn+"/DataFlowDebugSessionClient.QueryByFactory")
531		defer func() {
532			sc := -1
533			if result.Response().Response.Response != nil {
534				sc = result.page.Response().Response.Response.StatusCode
535			}
536			tracing.EndSpan(ctx, sc, err)
537		}()
538	}
539	result.page, err = client.QueryByFactory(ctx, resourceGroupName, factoryName)
540	return
541}
542