1package logic
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/tracing"
14	"net/http"
15)
16
17// IntegrationServiceEnvironmentsClient is the REST API for Azure Logic Apps.
18type IntegrationServiceEnvironmentsClient struct {
19	BaseClient
20}
21
22// NewIntegrationServiceEnvironmentsClient creates an instance of the IntegrationServiceEnvironmentsClient client.
23func NewIntegrationServiceEnvironmentsClient(subscriptionID string) IntegrationServiceEnvironmentsClient {
24	return NewIntegrationServiceEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID)
25}
26
27// NewIntegrationServiceEnvironmentsClientWithBaseURI creates an instance of the IntegrationServiceEnvironmentsClient
28// client using a custom endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI
29// (sovereign clouds, Azure stack).
30func NewIntegrationServiceEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationServiceEnvironmentsClient {
31	return IntegrationServiceEnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)}
32}
33
34// CreateOrUpdate creates or updates an integration service environment.
35// Parameters:
36// resourceGroup - the resource group.
37// integrationServiceEnvironmentName - the integration service environment name.
38// integrationServiceEnvironment - the integration service environment.
39func (client IntegrationServiceEnvironmentsClient) CreateOrUpdate(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, integrationServiceEnvironment IntegrationServiceEnvironment) (result IntegrationServiceEnvironmentsCreateOrUpdateFuture, err error) {
40	if tracing.IsEnabled() {
41		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.CreateOrUpdate")
42		defer func() {
43			sc := -1
44			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
45				sc = result.FutureAPI.Response().StatusCode
46			}
47			tracing.EndSpan(ctx, sc, err)
48		}()
49	}
50	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroup, integrationServiceEnvironmentName, integrationServiceEnvironment)
51	if err != nil {
52		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request")
53		return
54	}
55
56	result, err = client.CreateOrUpdateSender(req)
57	if err != nil {
58		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "CreateOrUpdate", nil, "Failure sending request")
59		return
60	}
61
62	return
63}
64
65// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
66func (client IntegrationServiceEnvironmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, integrationServiceEnvironment IntegrationServiceEnvironment) (*http.Request, error) {
67	pathParameters := map[string]interface{}{
68		"integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName),
69		"resourceGroup":                     autorest.Encode("path", resourceGroup),
70		"subscriptionId":                    autorest.Encode("path", client.SubscriptionID),
71	}
72
73	const APIVersion = "2019-05-01"
74	queryParameters := map[string]interface{}{
75		"api-version": APIVersion,
76	}
77
78	preparer := autorest.CreatePreparer(
79		autorest.AsContentType("application/json; charset=utf-8"),
80		autorest.AsPut(),
81		autorest.WithBaseURL(client.BaseURI),
82		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}", pathParameters),
83		autorest.WithJSON(integrationServiceEnvironment),
84		autorest.WithQueryParameters(queryParameters))
85	return preparer.Prepare((&http.Request{}).WithContext(ctx))
86}
87
88// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
89// http.Response Body if it receives an error.
90func (client IntegrationServiceEnvironmentsClient) CreateOrUpdateSender(req *http.Request) (future IntegrationServiceEnvironmentsCreateOrUpdateFuture, err error) {
91	var resp *http.Response
92	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
93	if err != nil {
94		return
95	}
96	var azf azure.Future
97	azf, err = azure.NewFutureFromResponse(resp)
98	future.FutureAPI = &azf
99	future.Result = future.result
100	return
101}
102
103// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
104// closes the http.Response Body.
105func (client IntegrationServiceEnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationServiceEnvironment, err error) {
106	err = autorest.Respond(
107		resp,
108		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
109		autorest.ByUnmarshallingJSON(&result),
110		autorest.ByClosing())
111	result.Response = autorest.Response{Response: resp}
112	return
113}
114
115// Delete deletes an integration service environment.
116// Parameters:
117// resourceGroup - the resource group.
118// integrationServiceEnvironmentName - the integration service environment name.
119func (client IntegrationServiceEnvironmentsClient) Delete(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result autorest.Response, err error) {
120	if tracing.IsEnabled() {
121		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.Delete")
122		defer func() {
123			sc := -1
124			if result.Response != nil {
125				sc = result.Response.StatusCode
126			}
127			tracing.EndSpan(ctx, sc, err)
128		}()
129	}
130	req, err := client.DeletePreparer(ctx, resourceGroup, integrationServiceEnvironmentName)
131	if err != nil {
132		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Delete", nil, "Failure preparing request")
133		return
134	}
135
136	resp, err := client.DeleteSender(req)
137	if err != nil {
138		result.Response = resp
139		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Delete", resp, "Failure sending request")
140		return
141	}
142
143	result, err = client.DeleteResponder(resp)
144	if err != nil {
145		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Delete", resp, "Failure responding to request")
146		return
147	}
148
149	return
150}
151
152// DeletePreparer prepares the Delete request.
153func (client IntegrationServiceEnvironmentsClient) DeletePreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (*http.Request, error) {
154	pathParameters := map[string]interface{}{
155		"integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName),
156		"resourceGroup":                     autorest.Encode("path", resourceGroup),
157		"subscriptionId":                    autorest.Encode("path", client.SubscriptionID),
158	}
159
160	const APIVersion = "2019-05-01"
161	queryParameters := map[string]interface{}{
162		"api-version": APIVersion,
163	}
164
165	preparer := autorest.CreatePreparer(
166		autorest.AsDelete(),
167		autorest.WithBaseURL(client.BaseURI),
168		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}", pathParameters),
169		autorest.WithQueryParameters(queryParameters))
170	return preparer.Prepare((&http.Request{}).WithContext(ctx))
171}
172
173// DeleteSender sends the Delete request. The method will close the
174// http.Response Body if it receives an error.
175func (client IntegrationServiceEnvironmentsClient) DeleteSender(req *http.Request) (*http.Response, error) {
176	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
177}
178
179// DeleteResponder handles the response to the Delete request. The method always
180// closes the http.Response Body.
181func (client IntegrationServiceEnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
182	err = autorest.Respond(
183		resp,
184		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
185		autorest.ByClosing())
186	result.Response = resp
187	return
188}
189
190// Get gets an integration service environment.
191// Parameters:
192// resourceGroup - the resource group.
193// integrationServiceEnvironmentName - the integration service environment name.
194func (client IntegrationServiceEnvironmentsClient) Get(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result IntegrationServiceEnvironment, err error) {
195	if tracing.IsEnabled() {
196		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.Get")
197		defer func() {
198			sc := -1
199			if result.Response.Response != nil {
200				sc = result.Response.Response.StatusCode
201			}
202			tracing.EndSpan(ctx, sc, err)
203		}()
204	}
205	req, err := client.GetPreparer(ctx, resourceGroup, integrationServiceEnvironmentName)
206	if err != nil {
207		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Get", nil, "Failure preparing request")
208		return
209	}
210
211	resp, err := client.GetSender(req)
212	if err != nil {
213		result.Response = autorest.Response{Response: resp}
214		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Get", resp, "Failure sending request")
215		return
216	}
217
218	result, err = client.GetResponder(resp)
219	if err != nil {
220		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Get", resp, "Failure responding to request")
221		return
222	}
223
224	return
225}
226
227// GetPreparer prepares the Get request.
228func (client IntegrationServiceEnvironmentsClient) GetPreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (*http.Request, error) {
229	pathParameters := map[string]interface{}{
230		"integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName),
231		"resourceGroup":                     autorest.Encode("path", resourceGroup),
232		"subscriptionId":                    autorest.Encode("path", client.SubscriptionID),
233	}
234
235	const APIVersion = "2019-05-01"
236	queryParameters := map[string]interface{}{
237		"api-version": APIVersion,
238	}
239
240	preparer := autorest.CreatePreparer(
241		autorest.AsGet(),
242		autorest.WithBaseURL(client.BaseURI),
243		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}", pathParameters),
244		autorest.WithQueryParameters(queryParameters))
245	return preparer.Prepare((&http.Request{}).WithContext(ctx))
246}
247
248// GetSender sends the Get request. The method will close the
249// http.Response Body if it receives an error.
250func (client IntegrationServiceEnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) {
251	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
252}
253
254// GetResponder handles the response to the Get request. The method always
255// closes the http.Response Body.
256func (client IntegrationServiceEnvironmentsClient) GetResponder(resp *http.Response) (result IntegrationServiceEnvironment, err error) {
257	err = autorest.Respond(
258		resp,
259		azure.WithErrorUnlessStatusCode(http.StatusOK),
260		autorest.ByUnmarshallingJSON(&result),
261		autorest.ByClosing())
262	result.Response = autorest.Response{Response: resp}
263	return
264}
265
266// ListByResourceGroup gets a list of integration service environments by resource group.
267// Parameters:
268// resourceGroup - the resource group.
269// top - the number of items to be included in the result.
270func (client IntegrationServiceEnvironmentsClient) ListByResourceGroup(ctx context.Context, resourceGroup string, top *int32) (result IntegrationServiceEnvironmentListResultPage, err error) {
271	if tracing.IsEnabled() {
272		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.ListByResourceGroup")
273		defer func() {
274			sc := -1
275			if result.iselr.Response.Response != nil {
276				sc = result.iselr.Response.Response.StatusCode
277			}
278			tracing.EndSpan(ctx, sc, err)
279		}()
280	}
281	result.fn = client.listByResourceGroupNextResults
282	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroup, top)
283	if err != nil {
284		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request")
285		return
286	}
287
288	resp, err := client.ListByResourceGroupSender(req)
289	if err != nil {
290		result.iselr.Response = autorest.Response{Response: resp}
291		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure sending request")
292		return
293	}
294
295	result.iselr, err = client.ListByResourceGroupResponder(resp)
296	if err != nil {
297		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure responding to request")
298		return
299	}
300	if result.iselr.hasNextLink() && result.iselr.IsEmpty() {
301		err = result.NextWithContext(ctx)
302		return
303	}
304
305	return
306}
307
308// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
309func (client IntegrationServiceEnvironmentsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroup string, top *int32) (*http.Request, error) {
310	pathParameters := map[string]interface{}{
311		"resourceGroup":  autorest.Encode("path", resourceGroup),
312		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
313	}
314
315	const APIVersion = "2019-05-01"
316	queryParameters := map[string]interface{}{
317		"api-version": APIVersion,
318	}
319	if top != nil {
320		queryParameters["$top"] = autorest.Encode("query", *top)
321	}
322
323	preparer := autorest.CreatePreparer(
324		autorest.AsGet(),
325		autorest.WithBaseURL(client.BaseURI),
326		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments", pathParameters),
327		autorest.WithQueryParameters(queryParameters))
328	return preparer.Prepare((&http.Request{}).WithContext(ctx))
329}
330
331// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
332// http.Response Body if it receives an error.
333func (client IntegrationServiceEnvironmentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
334	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
335}
336
337// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
338// closes the http.Response Body.
339func (client IntegrationServiceEnvironmentsClient) ListByResourceGroupResponder(resp *http.Response) (result IntegrationServiceEnvironmentListResult, err error) {
340	err = autorest.Respond(
341		resp,
342		azure.WithErrorUnlessStatusCode(http.StatusOK),
343		autorest.ByUnmarshallingJSON(&result),
344		autorest.ByClosing())
345	result.Response = autorest.Response{Response: resp}
346	return
347}
348
349// listByResourceGroupNextResults retrieves the next set of results, if any.
350func (client IntegrationServiceEnvironmentsClient) listByResourceGroupNextResults(ctx context.Context, lastResults IntegrationServiceEnvironmentListResult) (result IntegrationServiceEnvironmentListResult, err error) {
351	req, err := lastResults.integrationServiceEnvironmentListResultPreparer(ctx)
352	if err != nil {
353		return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
354	}
355	if req == nil {
356		return
357	}
358	resp, err := client.ListByResourceGroupSender(req)
359	if err != nil {
360		result.Response = autorest.Response{Response: resp}
361		return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
362	}
363	result, err = client.ListByResourceGroupResponder(resp)
364	if err != nil {
365		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
366	}
367	return
368}
369
370// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
371func (client IntegrationServiceEnvironmentsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroup string, top *int32) (result IntegrationServiceEnvironmentListResultIterator, err error) {
372	if tracing.IsEnabled() {
373		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.ListByResourceGroup")
374		defer func() {
375			sc := -1
376			if result.Response().Response.Response != nil {
377				sc = result.page.Response().Response.Response.StatusCode
378			}
379			tracing.EndSpan(ctx, sc, err)
380		}()
381	}
382	result.page, err = client.ListByResourceGroup(ctx, resourceGroup, top)
383	return
384}
385
386// ListBySubscription gets a list of integration service environments by subscription.
387// Parameters:
388// top - the number of items to be included in the result.
389func (client IntegrationServiceEnvironmentsClient) ListBySubscription(ctx context.Context, top *int32) (result IntegrationServiceEnvironmentListResultPage, err error) {
390	if tracing.IsEnabled() {
391		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.ListBySubscription")
392		defer func() {
393			sc := -1
394			if result.iselr.Response.Response != nil {
395				sc = result.iselr.Response.Response.StatusCode
396			}
397			tracing.EndSpan(ctx, sc, err)
398		}()
399	}
400	result.fn = client.listBySubscriptionNextResults
401	req, err := client.ListBySubscriptionPreparer(ctx, top)
402	if err != nil {
403		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListBySubscription", nil, "Failure preparing request")
404		return
405	}
406
407	resp, err := client.ListBySubscriptionSender(req)
408	if err != nil {
409		result.iselr.Response = autorest.Response{Response: resp}
410		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListBySubscription", resp, "Failure sending request")
411		return
412	}
413
414	result.iselr, err = client.ListBySubscriptionResponder(resp)
415	if err != nil {
416		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "ListBySubscription", resp, "Failure responding to request")
417		return
418	}
419	if result.iselr.hasNextLink() && result.iselr.IsEmpty() {
420		err = result.NextWithContext(ctx)
421		return
422	}
423
424	return
425}
426
427// ListBySubscriptionPreparer prepares the ListBySubscription request.
428func (client IntegrationServiceEnvironmentsClient) ListBySubscriptionPreparer(ctx context.Context, top *int32) (*http.Request, error) {
429	pathParameters := map[string]interface{}{
430		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
431	}
432
433	const APIVersion = "2019-05-01"
434	queryParameters := map[string]interface{}{
435		"api-version": APIVersion,
436	}
437	if top != nil {
438		queryParameters["$top"] = autorest.Encode("query", *top)
439	}
440
441	preparer := autorest.CreatePreparer(
442		autorest.AsGet(),
443		autorest.WithBaseURL(client.BaseURI),
444		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationServiceEnvironments", pathParameters),
445		autorest.WithQueryParameters(queryParameters))
446	return preparer.Prepare((&http.Request{}).WithContext(ctx))
447}
448
449// ListBySubscriptionSender sends the ListBySubscription request. The method will close the
450// http.Response Body if it receives an error.
451func (client IntegrationServiceEnvironmentsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
452	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
453}
454
455// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
456// closes the http.Response Body.
457func (client IntegrationServiceEnvironmentsClient) ListBySubscriptionResponder(resp *http.Response) (result IntegrationServiceEnvironmentListResult, err error) {
458	err = autorest.Respond(
459		resp,
460		azure.WithErrorUnlessStatusCode(http.StatusOK),
461		autorest.ByUnmarshallingJSON(&result),
462		autorest.ByClosing())
463	result.Response = autorest.Response{Response: resp}
464	return
465}
466
467// listBySubscriptionNextResults retrieves the next set of results, if any.
468func (client IntegrationServiceEnvironmentsClient) listBySubscriptionNextResults(ctx context.Context, lastResults IntegrationServiceEnvironmentListResult) (result IntegrationServiceEnvironmentListResult, err error) {
469	req, err := lastResults.integrationServiceEnvironmentListResultPreparer(ctx)
470	if err != nil {
471		return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request")
472	}
473	if req == nil {
474		return
475	}
476	resp, err := client.ListBySubscriptionSender(req)
477	if err != nil {
478		result.Response = autorest.Response{Response: resp}
479		return result, autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request")
480	}
481	result, err = client.ListBySubscriptionResponder(resp)
482	if err != nil {
483		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request")
484	}
485	return
486}
487
488// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required.
489func (client IntegrationServiceEnvironmentsClient) ListBySubscriptionComplete(ctx context.Context, top *int32) (result IntegrationServiceEnvironmentListResultIterator, err error) {
490	if tracing.IsEnabled() {
491		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.ListBySubscription")
492		defer func() {
493			sc := -1
494			if result.Response().Response.Response != nil {
495				sc = result.page.Response().Response.Response.StatusCode
496			}
497			tracing.EndSpan(ctx, sc, err)
498		}()
499	}
500	result.page, err = client.ListBySubscription(ctx, top)
501	return
502}
503
504// Restart restarts an integration service environment.
505// Parameters:
506// resourceGroup - the resource group.
507// integrationServiceEnvironmentName - the integration service environment name.
508func (client IntegrationServiceEnvironmentsClient) Restart(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (result autorest.Response, err error) {
509	if tracing.IsEnabled() {
510		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.Restart")
511		defer func() {
512			sc := -1
513			if result.Response != nil {
514				sc = result.Response.StatusCode
515			}
516			tracing.EndSpan(ctx, sc, err)
517		}()
518	}
519	req, err := client.RestartPreparer(ctx, resourceGroup, integrationServiceEnvironmentName)
520	if err != nil {
521		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Restart", nil, "Failure preparing request")
522		return
523	}
524
525	resp, err := client.RestartSender(req)
526	if err != nil {
527		result.Response = resp
528		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Restart", resp, "Failure sending request")
529		return
530	}
531
532	result, err = client.RestartResponder(resp)
533	if err != nil {
534		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Restart", resp, "Failure responding to request")
535		return
536	}
537
538	return
539}
540
541// RestartPreparer prepares the Restart request.
542func (client IntegrationServiceEnvironmentsClient) RestartPreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string) (*http.Request, error) {
543	pathParameters := map[string]interface{}{
544		"integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName),
545		"resourceGroup":                     autorest.Encode("path", resourceGroup),
546		"subscriptionId":                    autorest.Encode("path", client.SubscriptionID),
547	}
548
549	const APIVersion = "2019-05-01"
550	queryParameters := map[string]interface{}{
551		"api-version": APIVersion,
552	}
553
554	preparer := autorest.CreatePreparer(
555		autorest.AsPost(),
556		autorest.WithBaseURL(client.BaseURI),
557		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/restart", pathParameters),
558		autorest.WithQueryParameters(queryParameters))
559	return preparer.Prepare((&http.Request{}).WithContext(ctx))
560}
561
562// RestartSender sends the Restart request. The method will close the
563// http.Response Body if it receives an error.
564func (client IntegrationServiceEnvironmentsClient) RestartSender(req *http.Request) (*http.Response, error) {
565	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
566}
567
568// RestartResponder handles the response to the Restart request. The method always
569// closes the http.Response Body.
570func (client IntegrationServiceEnvironmentsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) {
571	err = autorest.Respond(
572		resp,
573		azure.WithErrorUnlessStatusCode(http.StatusOK),
574		autorest.ByClosing())
575	result.Response = resp
576	return
577}
578
579// Update updates an integration service environment.
580// Parameters:
581// resourceGroup - the resource group.
582// integrationServiceEnvironmentName - the integration service environment name.
583// integrationServiceEnvironment - the integration service environment.
584func (client IntegrationServiceEnvironmentsClient) Update(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, integrationServiceEnvironment IntegrationServiceEnvironment) (result IntegrationServiceEnvironmentsUpdateFuture, err error) {
585	if tracing.IsEnabled() {
586		ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationServiceEnvironmentsClient.Update")
587		defer func() {
588			sc := -1
589			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
590				sc = result.FutureAPI.Response().StatusCode
591			}
592			tracing.EndSpan(ctx, sc, err)
593		}()
594	}
595	req, err := client.UpdatePreparer(ctx, resourceGroup, integrationServiceEnvironmentName, integrationServiceEnvironment)
596	if err != nil {
597		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Update", nil, "Failure preparing request")
598		return
599	}
600
601	result, err = client.UpdateSender(req)
602	if err != nil {
603		err = autorest.NewErrorWithError(err, "logic.IntegrationServiceEnvironmentsClient", "Update", nil, "Failure sending request")
604		return
605	}
606
607	return
608}
609
610// UpdatePreparer prepares the Update request.
611func (client IntegrationServiceEnvironmentsClient) UpdatePreparer(ctx context.Context, resourceGroup string, integrationServiceEnvironmentName string, integrationServiceEnvironment IntegrationServiceEnvironment) (*http.Request, error) {
612	pathParameters := map[string]interface{}{
613		"integrationServiceEnvironmentName": autorest.Encode("path", integrationServiceEnvironmentName),
614		"resourceGroup":                     autorest.Encode("path", resourceGroup),
615		"subscriptionId":                    autorest.Encode("path", client.SubscriptionID),
616	}
617
618	const APIVersion = "2019-05-01"
619	queryParameters := map[string]interface{}{
620		"api-version": APIVersion,
621	}
622
623	preparer := autorest.CreatePreparer(
624		autorest.AsContentType("application/json; charset=utf-8"),
625		autorest.AsPatch(),
626		autorest.WithBaseURL(client.BaseURI),
627		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}", pathParameters),
628		autorest.WithJSON(integrationServiceEnvironment),
629		autorest.WithQueryParameters(queryParameters))
630	return preparer.Prepare((&http.Request{}).WithContext(ctx))
631}
632
633// UpdateSender sends the Update request. The method will close the
634// http.Response Body if it receives an error.
635func (client IntegrationServiceEnvironmentsClient) UpdateSender(req *http.Request) (future IntegrationServiceEnvironmentsUpdateFuture, err error) {
636	var resp *http.Response
637	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
638	if err != nil {
639		return
640	}
641	var azf azure.Future
642	azf, err = azure.NewFutureFromResponse(resp)
643	future.FutureAPI = &azf
644	future.Result = future.result
645	return
646}
647
648// UpdateResponder handles the response to the Update request. The method always
649// closes the http.Response Body.
650func (client IntegrationServiceEnvironmentsClient) UpdateResponder(resp *http.Response) (result IntegrationServiceEnvironment, err error) {
651	err = autorest.Respond(
652		resp,
653		azure.WithErrorUnlessStatusCode(http.StatusOK),
654		autorest.ByUnmarshallingJSON(&result),
655		autorest.ByClosing())
656	result.Response = autorest.Response{Response: resp}
657	return
658}
659