1package datafactory
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// IntegrationRuntimesClient is the the Azure Data Factory V2 management API provides a RESTful set of web services
30// that interact with Azure Data Factory V2 services.
31type IntegrationRuntimesClient struct {
32	BaseClient
33}
34
35// NewIntegrationRuntimesClient creates an instance of the IntegrationRuntimesClient client.
36func NewIntegrationRuntimesClient(subscriptionID string) IntegrationRuntimesClient {
37	return NewIntegrationRuntimesClientWithBaseURI(DefaultBaseURI, subscriptionID)
38}
39
40// NewIntegrationRuntimesClientWithBaseURI creates an instance of the IntegrationRuntimesClient client using a custom
41// endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure
42// stack).
43func NewIntegrationRuntimesClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimesClient {
44	return IntegrationRuntimesClient{NewWithBaseURI(baseURI, subscriptionID)}
45}
46
47// CreateOrUpdate creates or updates an integration runtime.
48// Parameters:
49// resourceGroupName - the resource group name.
50// factoryName - the factory name.
51// integrationRuntimeName - the integration runtime name.
52// integrationRuntime - integration runtime resource definition.
53// ifMatch - eTag of the integration runtime entity. Should only be specified for update, for which it should
54// match existing entity or can be * for unconditional update.
55func (client IntegrationRuntimesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string, integrationRuntime IntegrationRuntimeResource, ifMatch string) (result IntegrationRuntimeResource, err error) {
56	if tracing.IsEnabled() {
57		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.CreateOrUpdate")
58		defer func() {
59			sc := -1
60			if result.Response.Response != nil {
61				sc = result.Response.Response.StatusCode
62			}
63			tracing.EndSpan(ctx, sc, err)
64		}()
65	}
66	if err := validation.Validate([]validation.Validation{
67		{TargetValue: resourceGroupName,
68			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
69				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
70				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
71		{TargetValue: factoryName,
72			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
73				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
74				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
75		{TargetValue: integrationRuntimeName,
76			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
77				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
78				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
79		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "CreateOrUpdate", err.Error())
80	}
81
82	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName, integrationRuntime, ifMatch)
83	if err != nil {
84		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "CreateOrUpdate", nil, "Failure preparing request")
85		return
86	}
87
88	resp, err := client.CreateOrUpdateSender(req)
89	if err != nil {
90		result.Response = autorest.Response{Response: resp}
91		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "CreateOrUpdate", resp, "Failure sending request")
92		return
93	}
94
95	result, err = client.CreateOrUpdateResponder(resp)
96	if err != nil {
97		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "CreateOrUpdate", resp, "Failure responding to request")
98		return
99	}
100
101	return
102}
103
104// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
105func (client IntegrationRuntimesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string, integrationRuntime IntegrationRuntimeResource, ifMatch string) (*http.Request, error) {
106	pathParameters := map[string]interface{}{
107		"factoryName":            autorest.Encode("path", factoryName),
108		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
109		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
110		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
111	}
112
113	const APIVersion = "2017-09-01-preview"
114	queryParameters := map[string]interface{}{
115		"api-version": APIVersion,
116	}
117
118	preparer := autorest.CreatePreparer(
119		autorest.AsContentType("application/json; charset=utf-8"),
120		autorest.AsPut(),
121		autorest.WithBaseURL(client.BaseURI),
122		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}", pathParameters),
123		autorest.WithJSON(integrationRuntime),
124		autorest.WithQueryParameters(queryParameters))
125	if len(ifMatch) > 0 {
126		preparer = autorest.DecoratePreparer(preparer,
127			autorest.WithHeader("If-Match", autorest.String(ifMatch)))
128	}
129	return preparer.Prepare((&http.Request{}).WithContext(ctx))
130}
131
132// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
133// http.Response Body if it receives an error.
134func (client IntegrationRuntimesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
135	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
136}
137
138// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
139// closes the http.Response Body.
140func (client IntegrationRuntimesClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationRuntimeResource, err error) {
141	err = autorest.Respond(
142		resp,
143		azure.WithErrorUnlessStatusCode(http.StatusOK),
144		autorest.ByUnmarshallingJSON(&result),
145		autorest.ByClosing())
146	result.Response = autorest.Response{Response: resp}
147	return
148}
149
150// Delete deletes an integration runtime.
151// Parameters:
152// resourceGroupName - the resource group name.
153// factoryName - the factory name.
154// integrationRuntimeName - the integration runtime name.
155func (client IntegrationRuntimesClient) Delete(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (result autorest.Response, err error) {
156	if tracing.IsEnabled() {
157		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.Delete")
158		defer func() {
159			sc := -1
160			if result.Response != nil {
161				sc = result.Response.StatusCode
162			}
163			tracing.EndSpan(ctx, sc, err)
164		}()
165	}
166	if err := validation.Validate([]validation.Validation{
167		{TargetValue: resourceGroupName,
168			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
169				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
170				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
171		{TargetValue: factoryName,
172			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
173				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
174				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
175		{TargetValue: integrationRuntimeName,
176			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
177				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
178				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
179		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "Delete", err.Error())
180	}
181
182	req, err := client.DeletePreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName)
183	if err != nil {
184		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Delete", nil, "Failure preparing request")
185		return
186	}
187
188	resp, err := client.DeleteSender(req)
189	if err != nil {
190		result.Response = resp
191		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Delete", resp, "Failure sending request")
192		return
193	}
194
195	result, err = client.DeleteResponder(resp)
196	if err != nil {
197		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Delete", resp, "Failure responding to request")
198		return
199	}
200
201	return
202}
203
204// DeletePreparer prepares the Delete request.
205func (client IntegrationRuntimesClient) DeletePreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (*http.Request, error) {
206	pathParameters := map[string]interface{}{
207		"factoryName":            autorest.Encode("path", factoryName),
208		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
209		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
210		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
211	}
212
213	const APIVersion = "2017-09-01-preview"
214	queryParameters := map[string]interface{}{
215		"api-version": APIVersion,
216	}
217
218	preparer := autorest.CreatePreparer(
219		autorest.AsDelete(),
220		autorest.WithBaseURL(client.BaseURI),
221		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}", pathParameters),
222		autorest.WithQueryParameters(queryParameters))
223	return preparer.Prepare((&http.Request{}).WithContext(ctx))
224}
225
226// DeleteSender sends the Delete request. The method will close the
227// http.Response Body if it receives an error.
228func (client IntegrationRuntimesClient) DeleteSender(req *http.Request) (*http.Response, error) {
229	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
230}
231
232// DeleteResponder handles the response to the Delete request. The method always
233// closes the http.Response Body.
234func (client IntegrationRuntimesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
235	err = autorest.Respond(
236		resp,
237		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
238		autorest.ByClosing())
239	result.Response = resp
240	return
241}
242
243// Get gets an integration runtime.
244// Parameters:
245// resourceGroupName - the resource group name.
246// factoryName - the factory name.
247// integrationRuntimeName - the integration runtime name.
248func (client IntegrationRuntimesClient) Get(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (result IntegrationRuntimeResource, err error) {
249	if tracing.IsEnabled() {
250		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.Get")
251		defer func() {
252			sc := -1
253			if result.Response.Response != nil {
254				sc = result.Response.Response.StatusCode
255			}
256			tracing.EndSpan(ctx, sc, err)
257		}()
258	}
259	if err := validation.Validate([]validation.Validation{
260		{TargetValue: resourceGroupName,
261			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
262				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
263				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
264		{TargetValue: factoryName,
265			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
266				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
267				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
268		{TargetValue: integrationRuntimeName,
269			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
270				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
271				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
272		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "Get", err.Error())
273	}
274
275	req, err := client.GetPreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName)
276	if err != nil {
277		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Get", nil, "Failure preparing request")
278		return
279	}
280
281	resp, err := client.GetSender(req)
282	if err != nil {
283		result.Response = autorest.Response{Response: resp}
284		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Get", resp, "Failure sending request")
285		return
286	}
287
288	result, err = client.GetResponder(resp)
289	if err != nil {
290		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Get", resp, "Failure responding to request")
291		return
292	}
293
294	return
295}
296
297// GetPreparer prepares the Get request.
298func (client IntegrationRuntimesClient) GetPreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (*http.Request, error) {
299	pathParameters := map[string]interface{}{
300		"factoryName":            autorest.Encode("path", factoryName),
301		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
302		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
303		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
304	}
305
306	const APIVersion = "2017-09-01-preview"
307	queryParameters := map[string]interface{}{
308		"api-version": APIVersion,
309	}
310
311	preparer := autorest.CreatePreparer(
312		autorest.AsGet(),
313		autorest.WithBaseURL(client.BaseURI),
314		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}", pathParameters),
315		autorest.WithQueryParameters(queryParameters))
316	return preparer.Prepare((&http.Request{}).WithContext(ctx))
317}
318
319// GetSender sends the Get request. The method will close the
320// http.Response Body if it receives an error.
321func (client IntegrationRuntimesClient) GetSender(req *http.Request) (*http.Response, error) {
322	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
323}
324
325// GetResponder handles the response to the Get request. The method always
326// closes the http.Response Body.
327func (client IntegrationRuntimesClient) GetResponder(resp *http.Response) (result IntegrationRuntimeResource, err error) {
328	err = autorest.Respond(
329		resp,
330		azure.WithErrorUnlessStatusCode(http.StatusOK),
331		autorest.ByUnmarshallingJSON(&result),
332		autorest.ByClosing())
333	result.Response = autorest.Response{Response: resp}
334	return
335}
336
337// GetConnectionInfo gets the on-premises integration runtime connection information for encrypting the on-premises
338// data source credentials.
339// Parameters:
340// resourceGroupName - the resource group name.
341// factoryName - the factory name.
342// integrationRuntimeName - the integration runtime name.
343func (client IntegrationRuntimesClient) GetConnectionInfo(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (result IntegrationRuntimeConnectionInfo, err error) {
344	if tracing.IsEnabled() {
345		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.GetConnectionInfo")
346		defer func() {
347			sc := -1
348			if result.Response.Response != nil {
349				sc = result.Response.Response.StatusCode
350			}
351			tracing.EndSpan(ctx, sc, err)
352		}()
353	}
354	if err := validation.Validate([]validation.Validation{
355		{TargetValue: resourceGroupName,
356			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
357				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
358				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
359		{TargetValue: factoryName,
360			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
361				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
362				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
363		{TargetValue: integrationRuntimeName,
364			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
365				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
366				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
367		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "GetConnectionInfo", err.Error())
368	}
369
370	req, err := client.GetConnectionInfoPreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName)
371	if err != nil {
372		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "GetConnectionInfo", nil, "Failure preparing request")
373		return
374	}
375
376	resp, err := client.GetConnectionInfoSender(req)
377	if err != nil {
378		result.Response = autorest.Response{Response: resp}
379		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "GetConnectionInfo", resp, "Failure sending request")
380		return
381	}
382
383	result, err = client.GetConnectionInfoResponder(resp)
384	if err != nil {
385		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "GetConnectionInfo", resp, "Failure responding to request")
386		return
387	}
388
389	return
390}
391
392// GetConnectionInfoPreparer prepares the GetConnectionInfo request.
393func (client IntegrationRuntimesClient) GetConnectionInfoPreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (*http.Request, error) {
394	pathParameters := map[string]interface{}{
395		"factoryName":            autorest.Encode("path", factoryName),
396		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
397		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
398		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
399	}
400
401	const APIVersion = "2017-09-01-preview"
402	queryParameters := map[string]interface{}{
403		"api-version": APIVersion,
404	}
405
406	preparer := autorest.CreatePreparer(
407		autorest.AsPost(),
408		autorest.WithBaseURL(client.BaseURI),
409		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/getConnectionInfo", pathParameters),
410		autorest.WithQueryParameters(queryParameters))
411	return preparer.Prepare((&http.Request{}).WithContext(ctx))
412}
413
414// GetConnectionInfoSender sends the GetConnectionInfo request. The method will close the
415// http.Response Body if it receives an error.
416func (client IntegrationRuntimesClient) GetConnectionInfoSender(req *http.Request) (*http.Response, error) {
417	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
418}
419
420// GetConnectionInfoResponder handles the response to the GetConnectionInfo request. The method always
421// closes the http.Response Body.
422func (client IntegrationRuntimesClient) GetConnectionInfoResponder(resp *http.Response) (result IntegrationRuntimeConnectionInfo, err error) {
423	err = autorest.Respond(
424		resp,
425		azure.WithErrorUnlessStatusCode(http.StatusOK),
426		autorest.ByUnmarshallingJSON(&result),
427		autorest.ByClosing())
428	result.Response = autorest.Response{Response: resp}
429	return
430}
431
432// GetMonitoringData get the integration runtime monitoring data, which includes the monitor data for all the nodes
433// under this integration runtime.
434// Parameters:
435// resourceGroupName - the resource group name.
436// factoryName - the factory name.
437// integrationRuntimeName - the integration runtime name.
438func (client IntegrationRuntimesClient) GetMonitoringData(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (result IntegrationRuntimeMonitoringData, err error) {
439	if tracing.IsEnabled() {
440		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.GetMonitoringData")
441		defer func() {
442			sc := -1
443			if result.Response.Response != nil {
444				sc = result.Response.Response.StatusCode
445			}
446			tracing.EndSpan(ctx, sc, err)
447		}()
448	}
449	if err := validation.Validate([]validation.Validation{
450		{TargetValue: resourceGroupName,
451			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
452				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
453				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
454		{TargetValue: factoryName,
455			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
456				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
457				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
458		{TargetValue: integrationRuntimeName,
459			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
460				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
461				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
462		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "GetMonitoringData", err.Error())
463	}
464
465	req, err := client.GetMonitoringDataPreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName)
466	if err != nil {
467		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "GetMonitoringData", nil, "Failure preparing request")
468		return
469	}
470
471	resp, err := client.GetMonitoringDataSender(req)
472	if err != nil {
473		result.Response = autorest.Response{Response: resp}
474		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "GetMonitoringData", resp, "Failure sending request")
475		return
476	}
477
478	result, err = client.GetMonitoringDataResponder(resp)
479	if err != nil {
480		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "GetMonitoringData", resp, "Failure responding to request")
481		return
482	}
483
484	return
485}
486
487// GetMonitoringDataPreparer prepares the GetMonitoringData request.
488func (client IntegrationRuntimesClient) GetMonitoringDataPreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (*http.Request, error) {
489	pathParameters := map[string]interface{}{
490		"factoryName":            autorest.Encode("path", factoryName),
491		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
492		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
493		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
494	}
495
496	const APIVersion = "2017-09-01-preview"
497	queryParameters := map[string]interface{}{
498		"api-version": APIVersion,
499	}
500
501	preparer := autorest.CreatePreparer(
502		autorest.AsPost(),
503		autorest.WithBaseURL(client.BaseURI),
504		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/monitoringData", pathParameters),
505		autorest.WithQueryParameters(queryParameters))
506	return preparer.Prepare((&http.Request{}).WithContext(ctx))
507}
508
509// GetMonitoringDataSender sends the GetMonitoringData request. The method will close the
510// http.Response Body if it receives an error.
511func (client IntegrationRuntimesClient) GetMonitoringDataSender(req *http.Request) (*http.Response, error) {
512	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
513}
514
515// GetMonitoringDataResponder handles the response to the GetMonitoringData request. The method always
516// closes the http.Response Body.
517func (client IntegrationRuntimesClient) GetMonitoringDataResponder(resp *http.Response) (result IntegrationRuntimeMonitoringData, err error) {
518	err = autorest.Respond(
519		resp,
520		azure.WithErrorUnlessStatusCode(http.StatusOK),
521		autorest.ByUnmarshallingJSON(&result),
522		autorest.ByClosing())
523	result.Response = autorest.Response{Response: resp}
524	return
525}
526
527// GetStatus gets detailed status information for an integration runtime.
528// Parameters:
529// resourceGroupName - the resource group name.
530// factoryName - the factory name.
531// integrationRuntimeName - the integration runtime name.
532func (client IntegrationRuntimesClient) GetStatus(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (result IntegrationRuntimeStatusResponse, err error) {
533	if tracing.IsEnabled() {
534		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.GetStatus")
535		defer func() {
536			sc := -1
537			if result.Response.Response != nil {
538				sc = result.Response.Response.StatusCode
539			}
540			tracing.EndSpan(ctx, sc, err)
541		}()
542	}
543	if err := validation.Validate([]validation.Validation{
544		{TargetValue: resourceGroupName,
545			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
546				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
547				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
548		{TargetValue: factoryName,
549			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
550				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
551				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
552		{TargetValue: integrationRuntimeName,
553			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
554				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
555				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
556		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "GetStatus", err.Error())
557	}
558
559	req, err := client.GetStatusPreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName)
560	if err != nil {
561		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "GetStatus", nil, "Failure preparing request")
562		return
563	}
564
565	resp, err := client.GetStatusSender(req)
566	if err != nil {
567		result.Response = autorest.Response{Response: resp}
568		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "GetStatus", resp, "Failure sending request")
569		return
570	}
571
572	result, err = client.GetStatusResponder(resp)
573	if err != nil {
574		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "GetStatus", resp, "Failure responding to request")
575		return
576	}
577
578	return
579}
580
581// GetStatusPreparer prepares the GetStatus request.
582func (client IntegrationRuntimesClient) GetStatusPreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (*http.Request, error) {
583	pathParameters := map[string]interface{}{
584		"factoryName":            autorest.Encode("path", factoryName),
585		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
586		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
587		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
588	}
589
590	const APIVersion = "2017-09-01-preview"
591	queryParameters := map[string]interface{}{
592		"api-version": APIVersion,
593	}
594
595	preparer := autorest.CreatePreparer(
596		autorest.AsPost(),
597		autorest.WithBaseURL(client.BaseURI),
598		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/getStatus", pathParameters),
599		autorest.WithQueryParameters(queryParameters))
600	return preparer.Prepare((&http.Request{}).WithContext(ctx))
601}
602
603// GetStatusSender sends the GetStatus request. The method will close the
604// http.Response Body if it receives an error.
605func (client IntegrationRuntimesClient) GetStatusSender(req *http.Request) (*http.Response, error) {
606	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
607}
608
609// GetStatusResponder handles the response to the GetStatus request. The method always
610// closes the http.Response Body.
611func (client IntegrationRuntimesClient) GetStatusResponder(resp *http.Response) (result IntegrationRuntimeStatusResponse, err error) {
612	err = autorest.Respond(
613		resp,
614		azure.WithErrorUnlessStatusCode(http.StatusOK),
615		autorest.ByUnmarshallingJSON(&result),
616		autorest.ByClosing())
617	result.Response = autorest.Response{Response: resp}
618	return
619}
620
621// ListAuthKeys retrieves the authentication keys for an integration runtime.
622// Parameters:
623// resourceGroupName - the resource group name.
624// factoryName - the factory name.
625// integrationRuntimeName - the integration runtime name.
626func (client IntegrationRuntimesClient) ListAuthKeys(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (result IntegrationRuntimeAuthKeys, err error) {
627	if tracing.IsEnabled() {
628		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.ListAuthKeys")
629		defer func() {
630			sc := -1
631			if result.Response.Response != nil {
632				sc = result.Response.Response.StatusCode
633			}
634			tracing.EndSpan(ctx, sc, err)
635		}()
636	}
637	if err := validation.Validate([]validation.Validation{
638		{TargetValue: resourceGroupName,
639			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
640				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
641				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
642		{TargetValue: factoryName,
643			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
644				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
645				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
646		{TargetValue: integrationRuntimeName,
647			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
648				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
649				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
650		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "ListAuthKeys", err.Error())
651	}
652
653	req, err := client.ListAuthKeysPreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName)
654	if err != nil {
655		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "ListAuthKeys", nil, "Failure preparing request")
656		return
657	}
658
659	resp, err := client.ListAuthKeysSender(req)
660	if err != nil {
661		result.Response = autorest.Response{Response: resp}
662		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "ListAuthKeys", resp, "Failure sending request")
663		return
664	}
665
666	result, err = client.ListAuthKeysResponder(resp)
667	if err != nil {
668		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "ListAuthKeys", resp, "Failure responding to request")
669		return
670	}
671
672	return
673}
674
675// ListAuthKeysPreparer prepares the ListAuthKeys request.
676func (client IntegrationRuntimesClient) ListAuthKeysPreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (*http.Request, error) {
677	pathParameters := map[string]interface{}{
678		"factoryName":            autorest.Encode("path", factoryName),
679		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
680		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
681		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
682	}
683
684	const APIVersion = "2017-09-01-preview"
685	queryParameters := map[string]interface{}{
686		"api-version": APIVersion,
687	}
688
689	preparer := autorest.CreatePreparer(
690		autorest.AsPost(),
691		autorest.WithBaseURL(client.BaseURI),
692		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys", pathParameters),
693		autorest.WithQueryParameters(queryParameters))
694	return preparer.Prepare((&http.Request{}).WithContext(ctx))
695}
696
697// ListAuthKeysSender sends the ListAuthKeys request. The method will close the
698// http.Response Body if it receives an error.
699func (client IntegrationRuntimesClient) ListAuthKeysSender(req *http.Request) (*http.Response, error) {
700	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
701}
702
703// ListAuthKeysResponder handles the response to the ListAuthKeys request. The method always
704// closes the http.Response Body.
705func (client IntegrationRuntimesClient) ListAuthKeysResponder(resp *http.Response) (result IntegrationRuntimeAuthKeys, err error) {
706	err = autorest.Respond(
707		resp,
708		azure.WithErrorUnlessStatusCode(http.StatusOK),
709		autorest.ByUnmarshallingJSON(&result),
710		autorest.ByClosing())
711	result.Response = autorest.Response{Response: resp}
712	return
713}
714
715// ListByFactory lists integration runtimes.
716// Parameters:
717// resourceGroupName - the resource group name.
718// factoryName - the factory name.
719func (client IntegrationRuntimesClient) ListByFactory(ctx context.Context, resourceGroupName string, factoryName string) (result IntegrationRuntimeListResponsePage, err error) {
720	if tracing.IsEnabled() {
721		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.ListByFactory")
722		defer func() {
723			sc := -1
724			if result.irlr.Response.Response != nil {
725				sc = result.irlr.Response.Response.StatusCode
726			}
727			tracing.EndSpan(ctx, sc, err)
728		}()
729	}
730	if err := validation.Validate([]validation.Validation{
731		{TargetValue: resourceGroupName,
732			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
733				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
734				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
735		{TargetValue: factoryName,
736			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
737				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
738				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
739		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "ListByFactory", err.Error())
740	}
741
742	result.fn = client.listByFactoryNextResults
743	req, err := client.ListByFactoryPreparer(ctx, resourceGroupName, factoryName)
744	if err != nil {
745		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "ListByFactory", nil, "Failure preparing request")
746		return
747	}
748
749	resp, err := client.ListByFactorySender(req)
750	if err != nil {
751		result.irlr.Response = autorest.Response{Response: resp}
752		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "ListByFactory", resp, "Failure sending request")
753		return
754	}
755
756	result.irlr, err = client.ListByFactoryResponder(resp)
757	if err != nil {
758		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "ListByFactory", resp, "Failure responding to request")
759		return
760	}
761	if result.irlr.hasNextLink() && result.irlr.IsEmpty() {
762		err = result.NextWithContext(ctx)
763		return
764	}
765
766	return
767}
768
769// ListByFactoryPreparer prepares the ListByFactory request.
770func (client IntegrationRuntimesClient) ListByFactoryPreparer(ctx context.Context, resourceGroupName string, factoryName string) (*http.Request, error) {
771	pathParameters := map[string]interface{}{
772		"factoryName":       autorest.Encode("path", factoryName),
773		"resourceGroupName": autorest.Encode("path", resourceGroupName),
774		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
775	}
776
777	const APIVersion = "2017-09-01-preview"
778	queryParameters := map[string]interface{}{
779		"api-version": APIVersion,
780	}
781
782	preparer := autorest.CreatePreparer(
783		autorest.AsGet(),
784		autorest.WithBaseURL(client.BaseURI),
785		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes", pathParameters),
786		autorest.WithQueryParameters(queryParameters))
787	return preparer.Prepare((&http.Request{}).WithContext(ctx))
788}
789
790// ListByFactorySender sends the ListByFactory request. The method will close the
791// http.Response Body if it receives an error.
792func (client IntegrationRuntimesClient) ListByFactorySender(req *http.Request) (*http.Response, error) {
793	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
794}
795
796// ListByFactoryResponder handles the response to the ListByFactory request. The method always
797// closes the http.Response Body.
798func (client IntegrationRuntimesClient) ListByFactoryResponder(resp *http.Response) (result IntegrationRuntimeListResponse, err error) {
799	err = autorest.Respond(
800		resp,
801		azure.WithErrorUnlessStatusCode(http.StatusOK),
802		autorest.ByUnmarshallingJSON(&result),
803		autorest.ByClosing())
804	result.Response = autorest.Response{Response: resp}
805	return
806}
807
808// listByFactoryNextResults retrieves the next set of results, if any.
809func (client IntegrationRuntimesClient) listByFactoryNextResults(ctx context.Context, lastResults IntegrationRuntimeListResponse) (result IntegrationRuntimeListResponse, err error) {
810	req, err := lastResults.integrationRuntimeListResponsePreparer(ctx)
811	if err != nil {
812		return result, autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "listByFactoryNextResults", nil, "Failure preparing next results request")
813	}
814	if req == nil {
815		return
816	}
817	resp, err := client.ListByFactorySender(req)
818	if err != nil {
819		result.Response = autorest.Response{Response: resp}
820		return result, autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "listByFactoryNextResults", resp, "Failure sending next results request")
821	}
822	result, err = client.ListByFactoryResponder(resp)
823	if err != nil {
824		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "listByFactoryNextResults", resp, "Failure responding to next results request")
825	}
826	return
827}
828
829// ListByFactoryComplete enumerates all values, automatically crossing page boundaries as required.
830func (client IntegrationRuntimesClient) ListByFactoryComplete(ctx context.Context, resourceGroupName string, factoryName string) (result IntegrationRuntimeListResponseIterator, err error) {
831	if tracing.IsEnabled() {
832		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.ListByFactory")
833		defer func() {
834			sc := -1
835			if result.Response().Response.Response != nil {
836				sc = result.page.Response().Response.Response.StatusCode
837			}
838			tracing.EndSpan(ctx, sc, err)
839		}()
840	}
841	result.page, err = client.ListByFactory(ctx, resourceGroupName, factoryName)
842	return
843}
844
845// RegenerateAuthKey regenerates the authentication key for an integration runtime.
846// Parameters:
847// resourceGroupName - the resource group name.
848// factoryName - the factory name.
849// integrationRuntimeName - the integration runtime name.
850// regenerateKeyParameters - the parameters for regenerating integration runtime authentication key.
851func (client IntegrationRuntimesClient) RegenerateAuthKey(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string, regenerateKeyParameters IntegrationRuntimeRegenerateKeyParameters) (result IntegrationRuntimeAuthKeys, err error) {
852	if tracing.IsEnabled() {
853		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.RegenerateAuthKey")
854		defer func() {
855			sc := -1
856			if result.Response.Response != nil {
857				sc = result.Response.Response.StatusCode
858			}
859			tracing.EndSpan(ctx, sc, err)
860		}()
861	}
862	if err := validation.Validate([]validation.Validation{
863		{TargetValue: resourceGroupName,
864			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
865				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
866				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
867		{TargetValue: factoryName,
868			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
869				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
870				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
871		{TargetValue: integrationRuntimeName,
872			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
873				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
874				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
875		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "RegenerateAuthKey", err.Error())
876	}
877
878	req, err := client.RegenerateAuthKeyPreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName, regenerateKeyParameters)
879	if err != nil {
880		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "RegenerateAuthKey", nil, "Failure preparing request")
881		return
882	}
883
884	resp, err := client.RegenerateAuthKeySender(req)
885	if err != nil {
886		result.Response = autorest.Response{Response: resp}
887		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "RegenerateAuthKey", resp, "Failure sending request")
888		return
889	}
890
891	result, err = client.RegenerateAuthKeyResponder(resp)
892	if err != nil {
893		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "RegenerateAuthKey", resp, "Failure responding to request")
894		return
895	}
896
897	return
898}
899
900// RegenerateAuthKeyPreparer prepares the RegenerateAuthKey request.
901func (client IntegrationRuntimesClient) RegenerateAuthKeyPreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string, regenerateKeyParameters IntegrationRuntimeRegenerateKeyParameters) (*http.Request, error) {
902	pathParameters := map[string]interface{}{
903		"factoryName":            autorest.Encode("path", factoryName),
904		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
905		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
906		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
907	}
908
909	const APIVersion = "2017-09-01-preview"
910	queryParameters := map[string]interface{}{
911		"api-version": APIVersion,
912	}
913
914	preparer := autorest.CreatePreparer(
915		autorest.AsContentType("application/json; charset=utf-8"),
916		autorest.AsPost(),
917		autorest.WithBaseURL(client.BaseURI),
918		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey", pathParameters),
919		autorest.WithJSON(regenerateKeyParameters),
920		autorest.WithQueryParameters(queryParameters))
921	return preparer.Prepare((&http.Request{}).WithContext(ctx))
922}
923
924// RegenerateAuthKeySender sends the RegenerateAuthKey request. The method will close the
925// http.Response Body if it receives an error.
926func (client IntegrationRuntimesClient) RegenerateAuthKeySender(req *http.Request) (*http.Response, error) {
927	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
928}
929
930// RegenerateAuthKeyResponder handles the response to the RegenerateAuthKey request. The method always
931// closes the http.Response Body.
932func (client IntegrationRuntimesClient) RegenerateAuthKeyResponder(resp *http.Response) (result IntegrationRuntimeAuthKeys, err error) {
933	err = autorest.Respond(
934		resp,
935		azure.WithErrorUnlessStatusCode(http.StatusOK),
936		autorest.ByUnmarshallingJSON(&result),
937		autorest.ByClosing())
938	result.Response = autorest.Response{Response: resp}
939	return
940}
941
942// RemoveNode remove a node from integration runtime.
943// Parameters:
944// resourceGroupName - the resource group name.
945// factoryName - the factory name.
946// integrationRuntimeName - the integration runtime name.
947// removeNodeParameters - the name of the node to be removed from an integration runtime.
948func (client IntegrationRuntimesClient) RemoveNode(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string, removeNodeParameters IntegrationRuntimeRemoveNodeRequest) (result autorest.Response, err error) {
949	if tracing.IsEnabled() {
950		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.RemoveNode")
951		defer func() {
952			sc := -1
953			if result.Response != nil {
954				sc = result.Response.StatusCode
955			}
956			tracing.EndSpan(ctx, sc, err)
957		}()
958	}
959	if err := validation.Validate([]validation.Validation{
960		{TargetValue: resourceGroupName,
961			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
962				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
963				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
964		{TargetValue: factoryName,
965			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
966				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
967				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
968		{TargetValue: integrationRuntimeName,
969			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
970				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
971				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
972		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "RemoveNode", err.Error())
973	}
974
975	req, err := client.RemoveNodePreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName, removeNodeParameters)
976	if err != nil {
977		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "RemoveNode", nil, "Failure preparing request")
978		return
979	}
980
981	resp, err := client.RemoveNodeSender(req)
982	if err != nil {
983		result.Response = resp
984		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "RemoveNode", resp, "Failure sending request")
985		return
986	}
987
988	result, err = client.RemoveNodeResponder(resp)
989	if err != nil {
990		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "RemoveNode", resp, "Failure responding to request")
991		return
992	}
993
994	return
995}
996
997// RemoveNodePreparer prepares the RemoveNode request.
998func (client IntegrationRuntimesClient) RemoveNodePreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string, removeNodeParameters IntegrationRuntimeRemoveNodeRequest) (*http.Request, error) {
999	pathParameters := map[string]interface{}{
1000		"factoryName":            autorest.Encode("path", factoryName),
1001		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
1002		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
1003		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
1004	}
1005
1006	const APIVersion = "2017-09-01-preview"
1007	queryParameters := map[string]interface{}{
1008		"api-version": APIVersion,
1009	}
1010
1011	preparer := autorest.CreatePreparer(
1012		autorest.AsContentType("application/json; charset=utf-8"),
1013		autorest.AsPost(),
1014		autorest.WithBaseURL(client.BaseURI),
1015		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/removeNode", pathParameters),
1016		autorest.WithJSON(removeNodeParameters),
1017		autorest.WithQueryParameters(queryParameters))
1018	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1019}
1020
1021// RemoveNodeSender sends the RemoveNode request. The method will close the
1022// http.Response Body if it receives an error.
1023func (client IntegrationRuntimesClient) RemoveNodeSender(req *http.Request) (*http.Response, error) {
1024	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1025}
1026
1027// RemoveNodeResponder handles the response to the RemoveNode request. The method always
1028// closes the http.Response Body.
1029func (client IntegrationRuntimesClient) RemoveNodeResponder(resp *http.Response) (result autorest.Response, err error) {
1030	err = autorest.Respond(
1031		resp,
1032		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
1033		autorest.ByClosing())
1034	result.Response = resp
1035	return
1036}
1037
1038// Start starts a ManagedReserved type integration runtime.
1039// Parameters:
1040// resourceGroupName - the resource group name.
1041// factoryName - the factory name.
1042// integrationRuntimeName - the integration runtime name.
1043func (client IntegrationRuntimesClient) Start(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (result IntegrationRuntimesStartFuture, err error) {
1044	if tracing.IsEnabled() {
1045		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.Start")
1046		defer func() {
1047			sc := -1
1048			if result.Response() != nil {
1049				sc = result.Response().StatusCode
1050			}
1051			tracing.EndSpan(ctx, sc, err)
1052		}()
1053	}
1054	if err := validation.Validate([]validation.Validation{
1055		{TargetValue: resourceGroupName,
1056			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1057				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1058				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1059		{TargetValue: factoryName,
1060			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
1061				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
1062				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
1063		{TargetValue: integrationRuntimeName,
1064			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
1065				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
1066				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
1067		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "Start", err.Error())
1068	}
1069
1070	req, err := client.StartPreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName)
1071	if err != nil {
1072		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Start", nil, "Failure preparing request")
1073		return
1074	}
1075
1076	result, err = client.StartSender(req)
1077	if err != nil {
1078		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Start", nil, "Failure sending request")
1079		return
1080	}
1081
1082	return
1083}
1084
1085// StartPreparer prepares the Start request.
1086func (client IntegrationRuntimesClient) StartPreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (*http.Request, error) {
1087	pathParameters := map[string]interface{}{
1088		"factoryName":            autorest.Encode("path", factoryName),
1089		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
1090		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
1091		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
1092	}
1093
1094	const APIVersion = "2017-09-01-preview"
1095	queryParameters := map[string]interface{}{
1096		"api-version": APIVersion,
1097	}
1098
1099	preparer := autorest.CreatePreparer(
1100		autorest.AsPost(),
1101		autorest.WithBaseURL(client.BaseURI),
1102		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/start", pathParameters),
1103		autorest.WithQueryParameters(queryParameters))
1104	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1105}
1106
1107// StartSender sends the Start request. The method will close the
1108// http.Response Body if it receives an error.
1109func (client IntegrationRuntimesClient) StartSender(req *http.Request) (future IntegrationRuntimesStartFuture, err error) {
1110	var resp *http.Response
1111	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1112	if err != nil {
1113		return
1114	}
1115	var azf azure.Future
1116	azf, err = azure.NewFutureFromResponse(resp)
1117	future.FutureAPI = &azf
1118	future.Result = func(client IntegrationRuntimesClient) (irsr IntegrationRuntimeStatusResponse, err error) {
1119		var done bool
1120		done, err = future.DoneWithContext(context.Background(), client)
1121		if err != nil {
1122			err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesStartFuture", "Result", future.Response(), "Polling failure")
1123			return
1124		}
1125		if !done {
1126			err = azure.NewAsyncOpIncompleteError("datafactory.IntegrationRuntimesStartFuture")
1127			return
1128		}
1129		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1130		if irsr.Response.Response, err = future.GetResult(sender); err == nil && irsr.Response.Response.StatusCode != http.StatusNoContent {
1131			irsr, err = client.StartResponder(irsr.Response.Response)
1132			if err != nil {
1133				err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesStartFuture", "Result", irsr.Response.Response, "Failure responding to request")
1134			}
1135		}
1136		return
1137	}
1138	return
1139}
1140
1141// StartResponder handles the response to the Start request. The method always
1142// closes the http.Response Body.
1143func (client IntegrationRuntimesClient) StartResponder(resp *http.Response) (result IntegrationRuntimeStatusResponse, err error) {
1144	err = autorest.Respond(
1145		resp,
1146		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1147		autorest.ByUnmarshallingJSON(&result),
1148		autorest.ByClosing())
1149	result.Response = autorest.Response{Response: resp}
1150	return
1151}
1152
1153// Stop stops a ManagedReserved type integration runtime.
1154// Parameters:
1155// resourceGroupName - the resource group name.
1156// factoryName - the factory name.
1157// integrationRuntimeName - the integration runtime name.
1158func (client IntegrationRuntimesClient) Stop(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (result IntegrationRuntimesStopFuture, err error) {
1159	if tracing.IsEnabled() {
1160		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.Stop")
1161		defer func() {
1162			sc := -1
1163			if result.Response() != nil {
1164				sc = result.Response().StatusCode
1165			}
1166			tracing.EndSpan(ctx, sc, err)
1167		}()
1168	}
1169	if err := validation.Validate([]validation.Validation{
1170		{TargetValue: resourceGroupName,
1171			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1172				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1173				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1174		{TargetValue: factoryName,
1175			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
1176				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
1177				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
1178		{TargetValue: integrationRuntimeName,
1179			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
1180				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
1181				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
1182		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "Stop", err.Error())
1183	}
1184
1185	req, err := client.StopPreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName)
1186	if err != nil {
1187		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Stop", nil, "Failure preparing request")
1188		return
1189	}
1190
1191	result, err = client.StopSender(req)
1192	if err != nil {
1193		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Stop", nil, "Failure sending request")
1194		return
1195	}
1196
1197	return
1198}
1199
1200// StopPreparer prepares the Stop request.
1201func (client IntegrationRuntimesClient) StopPreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (*http.Request, error) {
1202	pathParameters := map[string]interface{}{
1203		"factoryName":            autorest.Encode("path", factoryName),
1204		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
1205		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
1206		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
1207	}
1208
1209	const APIVersion = "2017-09-01-preview"
1210	queryParameters := map[string]interface{}{
1211		"api-version": APIVersion,
1212	}
1213
1214	preparer := autorest.CreatePreparer(
1215		autorest.AsPost(),
1216		autorest.WithBaseURL(client.BaseURI),
1217		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/stop", pathParameters),
1218		autorest.WithQueryParameters(queryParameters))
1219	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1220}
1221
1222// StopSender sends the Stop request. The method will close the
1223// http.Response Body if it receives an error.
1224func (client IntegrationRuntimesClient) StopSender(req *http.Request) (future IntegrationRuntimesStopFuture, err error) {
1225	var resp *http.Response
1226	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1227	if err != nil {
1228		return
1229	}
1230	var azf azure.Future
1231	azf, err = azure.NewFutureFromResponse(resp)
1232	future.FutureAPI = &azf
1233	future.Result = func(client IntegrationRuntimesClient) (ar autorest.Response, err error) {
1234		var done bool
1235		done, err = future.DoneWithContext(context.Background(), client)
1236		if err != nil {
1237			err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesStopFuture", "Result", future.Response(), "Polling failure")
1238			return
1239		}
1240		if !done {
1241			err = azure.NewAsyncOpIncompleteError("datafactory.IntegrationRuntimesStopFuture")
1242			return
1243		}
1244		ar.Response = future.Response()
1245		return
1246	}
1247	return
1248}
1249
1250// StopResponder handles the response to the Stop request. The method always
1251// closes the http.Response Body.
1252func (client IntegrationRuntimesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {
1253	err = autorest.Respond(
1254		resp,
1255		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1256		autorest.ByClosing())
1257	result.Response = resp
1258	return
1259}
1260
1261// SyncCredentials force the integration runtime to synchronize credentials across integration runtime nodes, and this
1262// will override the credentials across all worker nodes with those available on the dispatcher node. If you already
1263// have the latest credential backup file, you should manually import it (preferred) on any self-hosted integration
1264// runtime node than using this API directly.
1265// Parameters:
1266// resourceGroupName - the resource group name.
1267// factoryName - the factory name.
1268// integrationRuntimeName - the integration runtime name.
1269func (client IntegrationRuntimesClient) SyncCredentials(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (result autorest.Response, err error) {
1270	if tracing.IsEnabled() {
1271		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.SyncCredentials")
1272		defer func() {
1273			sc := -1
1274			if result.Response != nil {
1275				sc = result.Response.StatusCode
1276			}
1277			tracing.EndSpan(ctx, sc, err)
1278		}()
1279	}
1280	if err := validation.Validate([]validation.Validation{
1281		{TargetValue: resourceGroupName,
1282			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1283				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1284				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1285		{TargetValue: factoryName,
1286			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
1287				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
1288				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
1289		{TargetValue: integrationRuntimeName,
1290			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
1291				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
1292				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
1293		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "SyncCredentials", err.Error())
1294	}
1295
1296	req, err := client.SyncCredentialsPreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName)
1297	if err != nil {
1298		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "SyncCredentials", nil, "Failure preparing request")
1299		return
1300	}
1301
1302	resp, err := client.SyncCredentialsSender(req)
1303	if err != nil {
1304		result.Response = resp
1305		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "SyncCredentials", resp, "Failure sending request")
1306		return
1307	}
1308
1309	result, err = client.SyncCredentialsResponder(resp)
1310	if err != nil {
1311		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "SyncCredentials", resp, "Failure responding to request")
1312		return
1313	}
1314
1315	return
1316}
1317
1318// SyncCredentialsPreparer prepares the SyncCredentials request.
1319func (client IntegrationRuntimesClient) SyncCredentialsPreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (*http.Request, error) {
1320	pathParameters := map[string]interface{}{
1321		"factoryName":            autorest.Encode("path", factoryName),
1322		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
1323		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
1324		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
1325	}
1326
1327	const APIVersion = "2017-09-01-preview"
1328	queryParameters := map[string]interface{}{
1329		"api-version": APIVersion,
1330	}
1331
1332	preparer := autorest.CreatePreparer(
1333		autorest.AsPost(),
1334		autorest.WithBaseURL(client.BaseURI),
1335		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/syncCredentials", pathParameters),
1336		autorest.WithQueryParameters(queryParameters))
1337	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1338}
1339
1340// SyncCredentialsSender sends the SyncCredentials request. The method will close the
1341// http.Response Body if it receives an error.
1342func (client IntegrationRuntimesClient) SyncCredentialsSender(req *http.Request) (*http.Response, error) {
1343	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1344}
1345
1346// SyncCredentialsResponder handles the response to the SyncCredentials request. The method always
1347// closes the http.Response Body.
1348func (client IntegrationRuntimesClient) SyncCredentialsResponder(resp *http.Response) (result autorest.Response, err error) {
1349	err = autorest.Respond(
1350		resp,
1351		azure.WithErrorUnlessStatusCode(http.StatusOK),
1352		autorest.ByClosing())
1353	result.Response = resp
1354	return
1355}
1356
1357// Update updates an integration runtime.
1358// Parameters:
1359// resourceGroupName - the resource group name.
1360// factoryName - the factory name.
1361// integrationRuntimeName - the integration runtime name.
1362// updateIntegrationRuntimeRequest - the parameters for updating an integration runtime.
1363func (client IntegrationRuntimesClient) Update(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string, updateIntegrationRuntimeRequest UpdateIntegrationRuntimeRequest) (result IntegrationRuntimeStatusResponse, err error) {
1364	if tracing.IsEnabled() {
1365		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.Update")
1366		defer func() {
1367			sc := -1
1368			if result.Response.Response != nil {
1369				sc = result.Response.Response.StatusCode
1370			}
1371			tracing.EndSpan(ctx, sc, err)
1372		}()
1373	}
1374	if err := validation.Validate([]validation.Validation{
1375		{TargetValue: resourceGroupName,
1376			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1377				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1378				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1379		{TargetValue: factoryName,
1380			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
1381				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
1382				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
1383		{TargetValue: integrationRuntimeName,
1384			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
1385				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
1386				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
1387		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "Update", err.Error())
1388	}
1389
1390	req, err := client.UpdatePreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName, updateIntegrationRuntimeRequest)
1391	if err != nil {
1392		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Update", nil, "Failure preparing request")
1393		return
1394	}
1395
1396	resp, err := client.UpdateSender(req)
1397	if err != nil {
1398		result.Response = autorest.Response{Response: resp}
1399		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Update", resp, "Failure sending request")
1400		return
1401	}
1402
1403	result, err = client.UpdateResponder(resp)
1404	if err != nil {
1405		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Update", resp, "Failure responding to request")
1406		return
1407	}
1408
1409	return
1410}
1411
1412// UpdatePreparer prepares the Update request.
1413func (client IntegrationRuntimesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string, updateIntegrationRuntimeRequest UpdateIntegrationRuntimeRequest) (*http.Request, error) {
1414	pathParameters := map[string]interface{}{
1415		"factoryName":            autorest.Encode("path", factoryName),
1416		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
1417		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
1418		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
1419	}
1420
1421	const APIVersion = "2017-09-01-preview"
1422	queryParameters := map[string]interface{}{
1423		"api-version": APIVersion,
1424	}
1425
1426	preparer := autorest.CreatePreparer(
1427		autorest.AsContentType("application/json; charset=utf-8"),
1428		autorest.AsPatch(),
1429		autorest.WithBaseURL(client.BaseURI),
1430		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}", pathParameters),
1431		autorest.WithJSON(updateIntegrationRuntimeRequest),
1432		autorest.WithQueryParameters(queryParameters))
1433	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1434}
1435
1436// UpdateSender sends the Update request. The method will close the
1437// http.Response Body if it receives an error.
1438func (client IntegrationRuntimesClient) UpdateSender(req *http.Request) (*http.Response, error) {
1439	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1440}
1441
1442// UpdateResponder handles the response to the Update request. The method always
1443// closes the http.Response Body.
1444func (client IntegrationRuntimesClient) UpdateResponder(resp *http.Response) (result IntegrationRuntimeStatusResponse, err error) {
1445	err = autorest.Respond(
1446		resp,
1447		azure.WithErrorUnlessStatusCode(http.StatusOK),
1448		autorest.ByUnmarshallingJSON(&result),
1449		autorest.ByClosing())
1450	result.Response = autorest.Response{Response: resp}
1451	return
1452}
1453
1454// Upgrade upgrade self-hosted integration runtime to latest version if availability.
1455// Parameters:
1456// resourceGroupName - the resource group name.
1457// factoryName - the factory name.
1458// integrationRuntimeName - the integration runtime name.
1459func (client IntegrationRuntimesClient) Upgrade(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (result autorest.Response, err error) {
1460	if tracing.IsEnabled() {
1461		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimesClient.Upgrade")
1462		defer func() {
1463			sc := -1
1464			if result.Response != nil {
1465				sc = result.Response.StatusCode
1466			}
1467			tracing.EndSpan(ctx, sc, err)
1468		}()
1469	}
1470	if err := validation.Validate([]validation.Validation{
1471		{TargetValue: resourceGroupName,
1472			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1473				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1474				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1475		{TargetValue: factoryName,
1476			Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil},
1477				{Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil},
1478				{Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}},
1479		{TargetValue: integrationRuntimeName,
1480			Constraints: []validation.Constraint{{Target: "integrationRuntimeName", Name: validation.MaxLength, Rule: 63, Chain: nil},
1481				{Target: "integrationRuntimeName", Name: validation.MinLength, Rule: 3, Chain: nil},
1482				{Target: "integrationRuntimeName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil {
1483		return result, validation.NewError("datafactory.IntegrationRuntimesClient", "Upgrade", err.Error())
1484	}
1485
1486	req, err := client.UpgradePreparer(ctx, resourceGroupName, factoryName, integrationRuntimeName)
1487	if err != nil {
1488		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Upgrade", nil, "Failure preparing request")
1489		return
1490	}
1491
1492	resp, err := client.UpgradeSender(req)
1493	if err != nil {
1494		result.Response = resp
1495		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Upgrade", resp, "Failure sending request")
1496		return
1497	}
1498
1499	result, err = client.UpgradeResponder(resp)
1500	if err != nil {
1501		err = autorest.NewErrorWithError(err, "datafactory.IntegrationRuntimesClient", "Upgrade", resp, "Failure responding to request")
1502		return
1503	}
1504
1505	return
1506}
1507
1508// UpgradePreparer prepares the Upgrade request.
1509func (client IntegrationRuntimesClient) UpgradePreparer(ctx context.Context, resourceGroupName string, factoryName string, integrationRuntimeName string) (*http.Request, error) {
1510	pathParameters := map[string]interface{}{
1511		"factoryName":            autorest.Encode("path", factoryName),
1512		"integrationRuntimeName": autorest.Encode("path", integrationRuntimeName),
1513		"resourceGroupName":      autorest.Encode("path", resourceGroupName),
1514		"subscriptionId":         autorest.Encode("path", client.SubscriptionID),
1515	}
1516
1517	const APIVersion = "2017-09-01-preview"
1518	queryParameters := map[string]interface{}{
1519		"api-version": APIVersion,
1520	}
1521
1522	preparer := autorest.CreatePreparer(
1523		autorest.AsPost(),
1524		autorest.WithBaseURL(client.BaseURI),
1525		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/upgrade", pathParameters),
1526		autorest.WithQueryParameters(queryParameters))
1527	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1528}
1529
1530// UpgradeSender sends the Upgrade request. The method will close the
1531// http.Response Body if it receives an error.
1532func (client IntegrationRuntimesClient) UpgradeSender(req *http.Request) (*http.Response, error) {
1533	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1534}
1535
1536// UpgradeResponder handles the response to the Upgrade request. The method always
1537// closes the http.Response Body.
1538func (client IntegrationRuntimesClient) UpgradeResponder(resp *http.Response) (result autorest.Response, err error) {
1539	err = autorest.Respond(
1540		resp,
1541		azure.WithErrorUnlessStatusCode(http.StatusOK),
1542		autorest.ByClosing())
1543	result.Response = resp
1544	return
1545}
1546