1package migrate
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// SolutionsClient is the migrate your workloads to Azure.
18type SolutionsClient struct {
19	BaseClient
20}
21
22// NewSolutionsClient creates an instance of the SolutionsClient client.
23func NewSolutionsClient(subscriptionID string, acceptLanguage string) SolutionsClient {
24	return NewSolutionsClientWithBaseURI(DefaultBaseURI, subscriptionID, acceptLanguage)
25}
26
27// NewSolutionsClientWithBaseURI creates an instance of the SolutionsClient client using a custom endpoint.  Use this
28// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
29func NewSolutionsClientWithBaseURI(baseURI string, subscriptionID string, acceptLanguage string) SolutionsClient {
30	return SolutionsClient{NewWithBaseURI(baseURI, subscriptionID, acceptLanguage)}
31}
32
33// CleanupSolutionData sends the cleanup solution data request.
34// Parameters:
35// resourceGroupName - name of the Azure Resource Group that migrate project is part of.
36// migrateProjectName - name of the Azure Migrate project.
37// solutionName - unique name of a migration solution within a migrate project.
38func (client SolutionsClient) CleanupSolutionData(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string) (result autorest.Response, err error) {
39	if tracing.IsEnabled() {
40		ctx = tracing.StartSpan(ctx, fqdn+"/SolutionsClient.CleanupSolutionData")
41		defer func() {
42			sc := -1
43			if result.Response != nil {
44				sc = result.Response.StatusCode
45			}
46			tracing.EndSpan(ctx, sc, err)
47		}()
48	}
49	req, err := client.CleanupSolutionDataPreparer(ctx, resourceGroupName, migrateProjectName, solutionName)
50	if err != nil {
51		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "CleanupSolutionData", nil, "Failure preparing request")
52		return
53	}
54
55	resp, err := client.CleanupSolutionDataSender(req)
56	if err != nil {
57		result.Response = resp
58		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "CleanupSolutionData", resp, "Failure sending request")
59		return
60	}
61
62	result, err = client.CleanupSolutionDataResponder(resp)
63	if err != nil {
64		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "CleanupSolutionData", resp, "Failure responding to request")
65		return
66	}
67
68	return
69}
70
71// CleanupSolutionDataPreparer prepares the CleanupSolutionData request.
72func (client SolutionsClient) CleanupSolutionDataPreparer(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string) (*http.Request, error) {
73	pathParameters := map[string]interface{}{
74		"migrateProjectName": autorest.Encode("path", migrateProjectName),
75		"resourceGroupName":  autorest.Encode("path", resourceGroupName),
76		"solutionName":       autorest.Encode("path", solutionName),
77		"subscriptionId":     autorest.Encode("path", client.SubscriptionID),
78	}
79
80	const APIVersion = "2018-09-01-preview"
81	queryParameters := map[string]interface{}{
82		"api-version": APIVersion,
83	}
84
85	preparer := autorest.CreatePreparer(
86		autorest.AsPost(),
87		autorest.WithBaseURL(client.BaseURI),
88		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}/cleanupData", pathParameters),
89		autorest.WithQueryParameters(queryParameters))
90	return preparer.Prepare((&http.Request{}).WithContext(ctx))
91}
92
93// CleanupSolutionDataSender sends the CleanupSolutionData request. The method will close the
94// http.Response Body if it receives an error.
95func (client SolutionsClient) CleanupSolutionDataSender(req *http.Request) (*http.Response, error) {
96	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
97}
98
99// CleanupSolutionDataResponder handles the response to the CleanupSolutionData request. The method always
100// closes the http.Response Body.
101func (client SolutionsClient) CleanupSolutionDataResponder(resp *http.Response) (result autorest.Response, err error) {
102	err = autorest.Respond(
103		resp,
104		azure.WithErrorUnlessStatusCode(http.StatusOK),
105		autorest.ByClosing())
106	result.Response = resp
107	return
108}
109
110// DeleteSolution delete the solution. Deleting non-existent project is a no-operation.
111// Parameters:
112// resourceGroupName - name of the Azure Resource Group that migrate project is part of.
113// migrateProjectName - name of the Azure Migrate project.
114// solutionName - unique name of a migration solution within a migrate project.
115func (client SolutionsClient) DeleteSolution(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string) (result autorest.Response, err error) {
116	if tracing.IsEnabled() {
117		ctx = tracing.StartSpan(ctx, fqdn+"/SolutionsClient.DeleteSolution")
118		defer func() {
119			sc := -1
120			if result.Response != nil {
121				sc = result.Response.StatusCode
122			}
123			tracing.EndSpan(ctx, sc, err)
124		}()
125	}
126	req, err := client.DeleteSolutionPreparer(ctx, resourceGroupName, migrateProjectName, solutionName)
127	if err != nil {
128		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "DeleteSolution", nil, "Failure preparing request")
129		return
130	}
131
132	resp, err := client.DeleteSolutionSender(req)
133	if err != nil {
134		result.Response = resp
135		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "DeleteSolution", resp, "Failure sending request")
136		return
137	}
138
139	result, err = client.DeleteSolutionResponder(resp)
140	if err != nil {
141		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "DeleteSolution", resp, "Failure responding to request")
142		return
143	}
144
145	return
146}
147
148// DeleteSolutionPreparer prepares the DeleteSolution request.
149func (client SolutionsClient) DeleteSolutionPreparer(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string) (*http.Request, error) {
150	pathParameters := map[string]interface{}{
151		"migrateProjectName": autorest.Encode("path", migrateProjectName),
152		"resourceGroupName":  autorest.Encode("path", resourceGroupName),
153		"solutionName":       autorest.Encode("path", solutionName),
154		"subscriptionId":     autorest.Encode("path", client.SubscriptionID),
155	}
156
157	const APIVersion = "2018-09-01-preview"
158	queryParameters := map[string]interface{}{
159		"api-version": APIVersion,
160	}
161
162	preparer := autorest.CreatePreparer(
163		autorest.AsDelete(),
164		autorest.WithBaseURL(client.BaseURI),
165		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}", pathParameters),
166		autorest.WithQueryParameters(queryParameters))
167	if len(client.AcceptLanguage) > 0 {
168		preparer = autorest.DecoratePreparer(preparer,
169			autorest.WithHeader("Accept-Language", autorest.String(client.AcceptLanguage)))
170	}
171	return preparer.Prepare((&http.Request{}).WithContext(ctx))
172}
173
174// DeleteSolutionSender sends the DeleteSolution request. The method will close the
175// http.Response Body if it receives an error.
176func (client SolutionsClient) DeleteSolutionSender(req *http.Request) (*http.Response, error) {
177	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
178}
179
180// DeleteSolutionResponder handles the response to the DeleteSolution request. The method always
181// closes the http.Response Body.
182func (client SolutionsClient) DeleteSolutionResponder(resp *http.Response) (result autorest.Response, err error) {
183	err = autorest.Respond(
184		resp,
185		azure.WithErrorUnlessStatusCode(http.StatusOK),
186		autorest.ByClosing())
187	result.Response = resp
188	return
189}
190
191// EnumerateSolutions sends the enumerate solutions request.
192// Parameters:
193// resourceGroupName - name of the Azure Resource Group that migrate project is part of.
194// migrateProjectName - name of the Azure Migrate project.
195func (client SolutionsClient) EnumerateSolutions(ctx context.Context, resourceGroupName string, migrateProjectName string) (result SolutionsCollection, err error) {
196	if tracing.IsEnabled() {
197		ctx = tracing.StartSpan(ctx, fqdn+"/SolutionsClient.EnumerateSolutions")
198		defer func() {
199			sc := -1
200			if result.Response.Response != nil {
201				sc = result.Response.Response.StatusCode
202			}
203			tracing.EndSpan(ctx, sc, err)
204		}()
205	}
206	req, err := client.EnumerateSolutionsPreparer(ctx, resourceGroupName, migrateProjectName)
207	if err != nil {
208		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "EnumerateSolutions", nil, "Failure preparing request")
209		return
210	}
211
212	resp, err := client.EnumerateSolutionsSender(req)
213	if err != nil {
214		result.Response = autorest.Response{Response: resp}
215		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "EnumerateSolutions", resp, "Failure sending request")
216		return
217	}
218
219	result, err = client.EnumerateSolutionsResponder(resp)
220	if err != nil {
221		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "EnumerateSolutions", resp, "Failure responding to request")
222		return
223	}
224
225	return
226}
227
228// EnumerateSolutionsPreparer prepares the EnumerateSolutions request.
229func (client SolutionsClient) EnumerateSolutionsPreparer(ctx context.Context, resourceGroupName string, migrateProjectName string) (*http.Request, error) {
230	pathParameters := map[string]interface{}{
231		"migrateProjectName": autorest.Encode("path", migrateProjectName),
232		"resourceGroupName":  autorest.Encode("path", resourceGroupName),
233		"subscriptionId":     autorest.Encode("path", client.SubscriptionID),
234	}
235
236	const APIVersion = "2018-09-01-preview"
237	queryParameters := map[string]interface{}{
238		"api-version": APIVersion,
239	}
240
241	preparer := autorest.CreatePreparer(
242		autorest.AsGet(),
243		autorest.WithBaseURL(client.BaseURI),
244		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions", pathParameters),
245		autorest.WithQueryParameters(queryParameters))
246	return preparer.Prepare((&http.Request{}).WithContext(ctx))
247}
248
249// EnumerateSolutionsSender sends the EnumerateSolutions request. The method will close the
250// http.Response Body if it receives an error.
251func (client SolutionsClient) EnumerateSolutionsSender(req *http.Request) (*http.Response, error) {
252	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
253}
254
255// EnumerateSolutionsResponder handles the response to the EnumerateSolutions request. The method always
256// closes the http.Response Body.
257func (client SolutionsClient) EnumerateSolutionsResponder(resp *http.Response) (result SolutionsCollection, err error) {
258	err = autorest.Respond(
259		resp,
260		azure.WithErrorUnlessStatusCode(http.StatusOK),
261		autorest.ByUnmarshallingJSON(&result),
262		autorest.ByClosing())
263	result.Response = autorest.Response{Response: resp}
264	return
265}
266
267// GetConfig sends the get config request.
268// Parameters:
269// resourceGroupName - name of the Azure Resource Group that migrate project is part of.
270// migrateProjectName - name of the Azure Migrate project.
271// solutionName - unique name of a migration solution within a migrate project.
272func (client SolutionsClient) GetConfig(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string) (result SolutionConfig, err error) {
273	if tracing.IsEnabled() {
274		ctx = tracing.StartSpan(ctx, fqdn+"/SolutionsClient.GetConfig")
275		defer func() {
276			sc := -1
277			if result.Response.Response != nil {
278				sc = result.Response.Response.StatusCode
279			}
280			tracing.EndSpan(ctx, sc, err)
281		}()
282	}
283	req, err := client.GetConfigPreparer(ctx, resourceGroupName, migrateProjectName, solutionName)
284	if err != nil {
285		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "GetConfig", nil, "Failure preparing request")
286		return
287	}
288
289	resp, err := client.GetConfigSender(req)
290	if err != nil {
291		result.Response = autorest.Response{Response: resp}
292		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "GetConfig", resp, "Failure sending request")
293		return
294	}
295
296	result, err = client.GetConfigResponder(resp)
297	if err != nil {
298		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "GetConfig", resp, "Failure responding to request")
299		return
300	}
301
302	return
303}
304
305// GetConfigPreparer prepares the GetConfig request.
306func (client SolutionsClient) GetConfigPreparer(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string) (*http.Request, error) {
307	pathParameters := map[string]interface{}{
308		"migrateProjectName": autorest.Encode("path", migrateProjectName),
309		"resourceGroupName":  autorest.Encode("path", resourceGroupName),
310		"solutionName":       autorest.Encode("path", solutionName),
311		"subscriptionId":     autorest.Encode("path", client.SubscriptionID),
312	}
313
314	const APIVersion = "2018-09-01-preview"
315	queryParameters := map[string]interface{}{
316		"api-version": APIVersion,
317	}
318
319	preparer := autorest.CreatePreparer(
320		autorest.AsPost(),
321		autorest.WithBaseURL(client.BaseURI),
322		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}/getConfig", pathParameters),
323		autorest.WithQueryParameters(queryParameters))
324	return preparer.Prepare((&http.Request{}).WithContext(ctx))
325}
326
327// GetConfigSender sends the GetConfig request. The method will close the
328// http.Response Body if it receives an error.
329func (client SolutionsClient) GetConfigSender(req *http.Request) (*http.Response, error) {
330	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
331}
332
333// GetConfigResponder handles the response to the GetConfig request. The method always
334// closes the http.Response Body.
335func (client SolutionsClient) GetConfigResponder(resp *http.Response) (result SolutionConfig, err error) {
336	err = autorest.Respond(
337		resp,
338		azure.WithErrorUnlessStatusCode(http.StatusOK),
339		autorest.ByUnmarshallingJSON(&result),
340		autorest.ByClosing())
341	result.Response = autorest.Response{Response: resp}
342	return
343}
344
345// GetSolution sends the get solution request.
346// Parameters:
347// resourceGroupName - name of the Azure Resource Group that migrate project is part of.
348// migrateProjectName - name of the Azure Migrate project.
349// solutionName - unique name of a migration solution within a migrate project.
350func (client SolutionsClient) GetSolution(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string) (result Solution, err error) {
351	if tracing.IsEnabled() {
352		ctx = tracing.StartSpan(ctx, fqdn+"/SolutionsClient.GetSolution")
353		defer func() {
354			sc := -1
355			if result.Response.Response != nil {
356				sc = result.Response.Response.StatusCode
357			}
358			tracing.EndSpan(ctx, sc, err)
359		}()
360	}
361	req, err := client.GetSolutionPreparer(ctx, resourceGroupName, migrateProjectName, solutionName)
362	if err != nil {
363		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "GetSolution", nil, "Failure preparing request")
364		return
365	}
366
367	resp, err := client.GetSolutionSender(req)
368	if err != nil {
369		result.Response = autorest.Response{Response: resp}
370		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "GetSolution", resp, "Failure sending request")
371		return
372	}
373
374	result, err = client.GetSolutionResponder(resp)
375	if err != nil {
376		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "GetSolution", resp, "Failure responding to request")
377		return
378	}
379
380	return
381}
382
383// GetSolutionPreparer prepares the GetSolution request.
384func (client SolutionsClient) GetSolutionPreparer(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string) (*http.Request, error) {
385	pathParameters := map[string]interface{}{
386		"migrateProjectName": autorest.Encode("path", migrateProjectName),
387		"resourceGroupName":  autorest.Encode("path", resourceGroupName),
388		"solutionName":       autorest.Encode("path", solutionName),
389		"subscriptionId":     autorest.Encode("path", client.SubscriptionID),
390	}
391
392	const APIVersion = "2018-09-01-preview"
393	queryParameters := map[string]interface{}{
394		"api-version": APIVersion,
395	}
396
397	preparer := autorest.CreatePreparer(
398		autorest.AsGet(),
399		autorest.WithBaseURL(client.BaseURI),
400		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}", pathParameters),
401		autorest.WithQueryParameters(queryParameters))
402	return preparer.Prepare((&http.Request{}).WithContext(ctx))
403}
404
405// GetSolutionSender sends the GetSolution request. The method will close the
406// http.Response Body if it receives an error.
407func (client SolutionsClient) GetSolutionSender(req *http.Request) (*http.Response, error) {
408	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
409}
410
411// GetSolutionResponder handles the response to the GetSolution request. The method always
412// closes the http.Response Body.
413func (client SolutionsClient) GetSolutionResponder(resp *http.Response) (result Solution, err error) {
414	err = autorest.Respond(
415		resp,
416		azure.WithErrorUnlessStatusCode(http.StatusOK),
417		autorest.ByUnmarshallingJSON(&result),
418		autorest.ByClosing())
419	result.Response = autorest.Response{Response: resp}
420	return
421}
422
423// PatchSolution update a solution with specified name. Supports partial updates, for example only tags can be
424// provided.
425// Parameters:
426// resourceGroupName - name of the Azure Resource Group that migrate project is part of.
427// migrateProjectName - name of the Azure Migrate project.
428// solutionName - unique name of a migration solution within a migrate project.
429// solutionInput - the input for the solution.
430func (client SolutionsClient) PatchSolution(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string, solutionInput Solution) (result Solution, err error) {
431	if tracing.IsEnabled() {
432		ctx = tracing.StartSpan(ctx, fqdn+"/SolutionsClient.PatchSolution")
433		defer func() {
434			sc := -1
435			if result.Response.Response != nil {
436				sc = result.Response.Response.StatusCode
437			}
438			tracing.EndSpan(ctx, sc, err)
439		}()
440	}
441	req, err := client.PatchSolutionPreparer(ctx, resourceGroupName, migrateProjectName, solutionName, solutionInput)
442	if err != nil {
443		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "PatchSolution", nil, "Failure preparing request")
444		return
445	}
446
447	resp, err := client.PatchSolutionSender(req)
448	if err != nil {
449		result.Response = autorest.Response{Response: resp}
450		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "PatchSolution", resp, "Failure sending request")
451		return
452	}
453
454	result, err = client.PatchSolutionResponder(resp)
455	if err != nil {
456		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "PatchSolution", resp, "Failure responding to request")
457		return
458	}
459
460	return
461}
462
463// PatchSolutionPreparer prepares the PatchSolution request.
464func (client SolutionsClient) PatchSolutionPreparer(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string, solutionInput Solution) (*http.Request, error) {
465	pathParameters := map[string]interface{}{
466		"migrateProjectName": autorest.Encode("path", migrateProjectName),
467		"resourceGroupName":  autorest.Encode("path", resourceGroupName),
468		"solutionName":       autorest.Encode("path", solutionName),
469		"subscriptionId":     autorest.Encode("path", client.SubscriptionID),
470	}
471
472	const APIVersion = "2018-09-01-preview"
473	queryParameters := map[string]interface{}{
474		"api-version": APIVersion,
475	}
476
477	solutionInput.ID = nil
478	solutionInput.Name = nil
479	solutionInput.Type = nil
480	preparer := autorest.CreatePreparer(
481		autorest.AsContentType("application/json; charset=utf-8"),
482		autorest.AsPatch(),
483		autorest.WithBaseURL(client.BaseURI),
484		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}", pathParameters),
485		autorest.WithJSON(solutionInput),
486		autorest.WithQueryParameters(queryParameters))
487	return preparer.Prepare((&http.Request{}).WithContext(ctx))
488}
489
490// PatchSolutionSender sends the PatchSolution request. The method will close the
491// http.Response Body if it receives an error.
492func (client SolutionsClient) PatchSolutionSender(req *http.Request) (*http.Response, error) {
493	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
494}
495
496// PatchSolutionResponder handles the response to the PatchSolution request. The method always
497// closes the http.Response Body.
498func (client SolutionsClient) PatchSolutionResponder(resp *http.Response) (result Solution, err error) {
499	err = autorest.Respond(
500		resp,
501		azure.WithErrorUnlessStatusCode(http.StatusOK),
502		autorest.ByUnmarshallingJSON(&result),
503		autorest.ByClosing())
504	result.Response = autorest.Response{Response: resp}
505	return
506}
507
508// PutSolution sends the put solution request.
509// Parameters:
510// resourceGroupName - name of the Azure Resource Group that migrate project is part of.
511// migrateProjectName - name of the Azure Migrate project.
512// solutionName - unique name of a migration solution within a migrate project.
513// solutionInput - the input for the solution.
514func (client SolutionsClient) PutSolution(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string, solutionInput Solution) (result Solution, err error) {
515	if tracing.IsEnabled() {
516		ctx = tracing.StartSpan(ctx, fqdn+"/SolutionsClient.PutSolution")
517		defer func() {
518			sc := -1
519			if result.Response.Response != nil {
520				sc = result.Response.Response.StatusCode
521			}
522			tracing.EndSpan(ctx, sc, err)
523		}()
524	}
525	req, err := client.PutSolutionPreparer(ctx, resourceGroupName, migrateProjectName, solutionName, solutionInput)
526	if err != nil {
527		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "PutSolution", nil, "Failure preparing request")
528		return
529	}
530
531	resp, err := client.PutSolutionSender(req)
532	if err != nil {
533		result.Response = autorest.Response{Response: resp}
534		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "PutSolution", resp, "Failure sending request")
535		return
536	}
537
538	result, err = client.PutSolutionResponder(resp)
539	if err != nil {
540		err = autorest.NewErrorWithError(err, "migrate.SolutionsClient", "PutSolution", resp, "Failure responding to request")
541		return
542	}
543
544	return
545}
546
547// PutSolutionPreparer prepares the PutSolution request.
548func (client SolutionsClient) PutSolutionPreparer(ctx context.Context, resourceGroupName string, migrateProjectName string, solutionName string, solutionInput Solution) (*http.Request, error) {
549	pathParameters := map[string]interface{}{
550		"migrateProjectName": autorest.Encode("path", migrateProjectName),
551		"resourceGroupName":  autorest.Encode("path", resourceGroupName),
552		"solutionName":       autorest.Encode("path", solutionName),
553		"subscriptionId":     autorest.Encode("path", client.SubscriptionID),
554	}
555
556	const APIVersion = "2018-09-01-preview"
557	queryParameters := map[string]interface{}{
558		"api-version": APIVersion,
559	}
560
561	solutionInput.ID = nil
562	solutionInput.Name = nil
563	solutionInput.Type = nil
564	preparer := autorest.CreatePreparer(
565		autorest.AsContentType("application/json; charset=utf-8"),
566		autorest.AsPut(),
567		autorest.WithBaseURL(client.BaseURI),
568		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}", pathParameters),
569		autorest.WithJSON(solutionInput),
570		autorest.WithQueryParameters(queryParameters))
571	return preparer.Prepare((&http.Request{}).WithContext(ctx))
572}
573
574// PutSolutionSender sends the PutSolution request. The method will close the
575// http.Response Body if it receives an error.
576func (client SolutionsClient) PutSolutionSender(req *http.Request) (*http.Response, error) {
577	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
578}
579
580// PutSolutionResponder handles the response to the PutSolution request. The method always
581// closes the http.Response Body.
582func (client SolutionsClient) PutSolutionResponder(resp *http.Response) (result Solution, err error) {
583	err = autorest.Respond(
584		resp,
585		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
586		autorest.ByUnmarshallingJSON(&result),
587		autorest.ByClosing())
588	result.Response = autorest.Response{Response: resp}
589	return
590}
591