1package authoring
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	"github.com/satori/go.uuid"
27	"net/http"
28)
29
30// VersionsClient is the client for the Versions methods of the Authoring service.
31type VersionsClient struct {
32	BaseClient
33}
34
35// NewVersionsClient creates an instance of the VersionsClient client.
36func NewVersionsClient(endpoint string) VersionsClient {
37	return VersionsClient{New(endpoint)}
38}
39
40// Clone creates a new version from the selected version.
41// Parameters:
42// appID - the application ID.
43// versionID - the version ID.
44// versionCloneObject - a model containing the new version ID.
45func (client VersionsClient) Clone(ctx context.Context, appID uuid.UUID, versionID string, versionCloneObject TaskUpdateObject) (result String, err error) {
46	if tracing.IsEnabled() {
47		ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Clone")
48		defer func() {
49			sc := -1
50			if result.Response.Response != nil {
51				sc = result.Response.Response.StatusCode
52			}
53			tracing.EndSpan(ctx, sc, err)
54		}()
55	}
56	req, err := client.ClonePreparer(ctx, appID, versionID, versionCloneObject)
57	if err != nil {
58		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Clone", nil, "Failure preparing request")
59		return
60	}
61
62	resp, err := client.CloneSender(req)
63	if err != nil {
64		result.Response = autorest.Response{Response: resp}
65		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Clone", resp, "Failure sending request")
66		return
67	}
68
69	result, err = client.CloneResponder(resp)
70	if err != nil {
71		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Clone", resp, "Failure responding to request")
72	}
73
74	return
75}
76
77// ClonePreparer prepares the Clone request.
78func (client VersionsClient) ClonePreparer(ctx context.Context, appID uuid.UUID, versionID string, versionCloneObject TaskUpdateObject) (*http.Request, error) {
79	urlParameters := map[string]interface{}{
80		"Endpoint": client.Endpoint,
81	}
82
83	pathParameters := map[string]interface{}{
84		"appId":     autorest.Encode("path", appID),
85		"versionId": autorest.Encode("path", versionID),
86	}
87
88	preparer := autorest.CreatePreparer(
89		autorest.AsContentType("application/json; charset=utf-8"),
90		autorest.AsPost(),
91		autorest.WithCustomBaseURL("{Endpoint}/luis/api/v2.0", urlParameters),
92		autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/clone", pathParameters),
93		autorest.WithJSON(versionCloneObject))
94	return preparer.Prepare((&http.Request{}).WithContext(ctx))
95}
96
97// CloneSender sends the Clone request. The method will close the
98// http.Response Body if it receives an error.
99func (client VersionsClient) CloneSender(req *http.Request) (*http.Response, error) {
100	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
101}
102
103// CloneResponder handles the response to the Clone request. The method always
104// closes the http.Response Body.
105func (client VersionsClient) CloneResponder(resp *http.Response) (result String, err error) {
106	err = autorest.Respond(
107		resp,
108		client.ByInspecting(),
109		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
110		autorest.ByUnmarshallingJSON(&result.Value),
111		autorest.ByClosing())
112	result.Response = autorest.Response{Response: resp}
113	return
114}
115
116// Delete deletes an application version.
117// Parameters:
118// appID - the application ID.
119// versionID - the version ID.
120func (client VersionsClient) Delete(ctx context.Context, appID uuid.UUID, versionID string) (result OperationStatus, err error) {
121	if tracing.IsEnabled() {
122		ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Delete")
123		defer func() {
124			sc := -1
125			if result.Response.Response != nil {
126				sc = result.Response.Response.StatusCode
127			}
128			tracing.EndSpan(ctx, sc, err)
129		}()
130	}
131	req, err := client.DeletePreparer(ctx, appID, versionID)
132	if err != nil {
133		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Delete", nil, "Failure preparing request")
134		return
135	}
136
137	resp, err := client.DeleteSender(req)
138	if err != nil {
139		result.Response = autorest.Response{Response: resp}
140		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Delete", resp, "Failure sending request")
141		return
142	}
143
144	result, err = client.DeleteResponder(resp)
145	if err != nil {
146		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Delete", resp, "Failure responding to request")
147	}
148
149	return
150}
151
152// DeletePreparer prepares the Delete request.
153func (client VersionsClient) DeletePreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) {
154	urlParameters := map[string]interface{}{
155		"Endpoint": client.Endpoint,
156	}
157
158	pathParameters := map[string]interface{}{
159		"appId":     autorest.Encode("path", appID),
160		"versionId": autorest.Encode("path", versionID),
161	}
162
163	preparer := autorest.CreatePreparer(
164		autorest.AsDelete(),
165		autorest.WithCustomBaseURL("{Endpoint}/luis/api/v2.0", urlParameters),
166		autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/", pathParameters))
167	return preparer.Prepare((&http.Request{}).WithContext(ctx))
168}
169
170// DeleteSender sends the Delete request. The method will close the
171// http.Response Body if it receives an error.
172func (client VersionsClient) DeleteSender(req *http.Request) (*http.Response, error) {
173	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
174}
175
176// DeleteResponder handles the response to the Delete request. The method always
177// closes the http.Response Body.
178func (client VersionsClient) DeleteResponder(resp *http.Response) (result OperationStatus, err error) {
179	err = autorest.Respond(
180		resp,
181		client.ByInspecting(),
182		azure.WithErrorUnlessStatusCode(http.StatusOK),
183		autorest.ByUnmarshallingJSON(&result),
184		autorest.ByClosing())
185	result.Response = autorest.Response{Response: resp}
186	return
187}
188
189// DeleteUnlabelledUtterance deleted an unlabelled utterance in a version of the application.
190// Parameters:
191// appID - the application ID.
192// versionID - the version ID.
193// utterance - the utterance text to delete.
194func (client VersionsClient) DeleteUnlabelledUtterance(ctx context.Context, appID uuid.UUID, versionID string, utterance string) (result OperationStatus, err error) {
195	if tracing.IsEnabled() {
196		ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.DeleteUnlabelledUtterance")
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.DeleteUnlabelledUtterancePreparer(ctx, appID, versionID, utterance)
206	if err != nil {
207		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "DeleteUnlabelledUtterance", nil, "Failure preparing request")
208		return
209	}
210
211	resp, err := client.DeleteUnlabelledUtteranceSender(req)
212	if err != nil {
213		result.Response = autorest.Response{Response: resp}
214		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "DeleteUnlabelledUtterance", resp, "Failure sending request")
215		return
216	}
217
218	result, err = client.DeleteUnlabelledUtteranceResponder(resp)
219	if err != nil {
220		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "DeleteUnlabelledUtterance", resp, "Failure responding to request")
221	}
222
223	return
224}
225
226// DeleteUnlabelledUtterancePreparer prepares the DeleteUnlabelledUtterance request.
227func (client VersionsClient) DeleteUnlabelledUtterancePreparer(ctx context.Context, appID uuid.UUID, versionID string, utterance string) (*http.Request, error) {
228	urlParameters := map[string]interface{}{
229		"Endpoint": client.Endpoint,
230	}
231
232	pathParameters := map[string]interface{}{
233		"appId":     autorest.Encode("path", appID),
234		"versionId": autorest.Encode("path", versionID),
235	}
236
237	preparer := autorest.CreatePreparer(
238		autorest.AsContentType("application/json; charset=utf-8"),
239		autorest.AsDelete(),
240		autorest.WithCustomBaseURL("{Endpoint}/luis/api/v2.0", urlParameters),
241		autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/suggest", pathParameters),
242		autorest.WithJSON(utterance))
243	return preparer.Prepare((&http.Request{}).WithContext(ctx))
244}
245
246// DeleteUnlabelledUtteranceSender sends the DeleteUnlabelledUtterance request. The method will close the
247// http.Response Body if it receives an error.
248func (client VersionsClient) DeleteUnlabelledUtteranceSender(req *http.Request) (*http.Response, error) {
249	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
250}
251
252// DeleteUnlabelledUtteranceResponder handles the response to the DeleteUnlabelledUtterance request. The method always
253// closes the http.Response Body.
254func (client VersionsClient) DeleteUnlabelledUtteranceResponder(resp *http.Response) (result OperationStatus, err error) {
255	err = autorest.Respond(
256		resp,
257		client.ByInspecting(),
258		azure.WithErrorUnlessStatusCode(http.StatusOK),
259		autorest.ByUnmarshallingJSON(&result),
260		autorest.ByClosing())
261	result.Response = autorest.Response{Response: resp}
262	return
263}
264
265// Export exports a LUIS application to JSON format.
266// Parameters:
267// appID - the application ID.
268// versionID - the version ID.
269func (client VersionsClient) Export(ctx context.Context, appID uuid.UUID, versionID string) (result LuisApp, err error) {
270	if tracing.IsEnabled() {
271		ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Export")
272		defer func() {
273			sc := -1
274			if result.Response.Response != nil {
275				sc = result.Response.Response.StatusCode
276			}
277			tracing.EndSpan(ctx, sc, err)
278		}()
279	}
280	req, err := client.ExportPreparer(ctx, appID, versionID)
281	if err != nil {
282		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Export", nil, "Failure preparing request")
283		return
284	}
285
286	resp, err := client.ExportSender(req)
287	if err != nil {
288		result.Response = autorest.Response{Response: resp}
289		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Export", resp, "Failure sending request")
290		return
291	}
292
293	result, err = client.ExportResponder(resp)
294	if err != nil {
295		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Export", resp, "Failure responding to request")
296	}
297
298	return
299}
300
301// ExportPreparer prepares the Export request.
302func (client VersionsClient) ExportPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) {
303	urlParameters := map[string]interface{}{
304		"Endpoint": client.Endpoint,
305	}
306
307	pathParameters := map[string]interface{}{
308		"appId":     autorest.Encode("path", appID),
309		"versionId": autorest.Encode("path", versionID),
310	}
311
312	preparer := autorest.CreatePreparer(
313		autorest.AsGet(),
314		autorest.WithCustomBaseURL("{Endpoint}/luis/api/v2.0", urlParameters),
315		autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/export", pathParameters))
316	return preparer.Prepare((&http.Request{}).WithContext(ctx))
317}
318
319// ExportSender sends the Export request. The method will close the
320// http.Response Body if it receives an error.
321func (client VersionsClient) ExportSender(req *http.Request) (*http.Response, error) {
322	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
323}
324
325// ExportResponder handles the response to the Export request. The method always
326// closes the http.Response Body.
327func (client VersionsClient) ExportResponder(resp *http.Response) (result LuisApp, err error) {
328	err = autorest.Respond(
329		resp,
330		client.ByInspecting(),
331		azure.WithErrorUnlessStatusCode(http.StatusOK),
332		autorest.ByUnmarshallingJSON(&result),
333		autorest.ByClosing())
334	result.Response = autorest.Response{Response: resp}
335	return
336}
337
338// Get gets the version information such as date created, last modified date, endpoint URL, count of intents and
339// entities, training and publishing status.
340// Parameters:
341// appID - the application ID.
342// versionID - the version ID.
343func (client VersionsClient) Get(ctx context.Context, appID uuid.UUID, versionID string) (result VersionInfo, err error) {
344	if tracing.IsEnabled() {
345		ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Get")
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	req, err := client.GetPreparer(ctx, appID, versionID)
355	if err != nil {
356		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Get", nil, "Failure preparing request")
357		return
358	}
359
360	resp, err := client.GetSender(req)
361	if err != nil {
362		result.Response = autorest.Response{Response: resp}
363		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Get", resp, "Failure sending request")
364		return
365	}
366
367	result, err = client.GetResponder(resp)
368	if err != nil {
369		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Get", resp, "Failure responding to request")
370	}
371
372	return
373}
374
375// GetPreparer prepares the Get request.
376func (client VersionsClient) GetPreparer(ctx context.Context, appID uuid.UUID, versionID string) (*http.Request, error) {
377	urlParameters := map[string]interface{}{
378		"Endpoint": client.Endpoint,
379	}
380
381	pathParameters := map[string]interface{}{
382		"appId":     autorest.Encode("path", appID),
383		"versionId": autorest.Encode("path", versionID),
384	}
385
386	preparer := autorest.CreatePreparer(
387		autorest.AsGet(),
388		autorest.WithCustomBaseURL("{Endpoint}/luis/api/v2.0", urlParameters),
389		autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/", pathParameters))
390	return preparer.Prepare((&http.Request{}).WithContext(ctx))
391}
392
393// GetSender sends the Get request. The method will close the
394// http.Response Body if it receives an error.
395func (client VersionsClient) GetSender(req *http.Request) (*http.Response, error) {
396	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
397}
398
399// GetResponder handles the response to the Get request. The method always
400// closes the http.Response Body.
401func (client VersionsClient) GetResponder(resp *http.Response) (result VersionInfo, err error) {
402	err = autorest.Respond(
403		resp,
404		client.ByInspecting(),
405		azure.WithErrorUnlessStatusCode(http.StatusOK),
406		autorest.ByUnmarshallingJSON(&result),
407		autorest.ByClosing())
408	result.Response = autorest.Response{Response: resp}
409	return
410}
411
412// Import imports a new version into a LUIS application.
413// Parameters:
414// appID - the application ID.
415// luisApp - a LUIS application structure.
416// versionID - the new versionId to import. If not specified, the versionId will be read from the imported
417// object.
418func (client VersionsClient) Import(ctx context.Context, appID uuid.UUID, luisApp LuisApp, versionID string) (result String, err error) {
419	if tracing.IsEnabled() {
420		ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Import")
421		defer func() {
422			sc := -1
423			if result.Response.Response != nil {
424				sc = result.Response.Response.StatusCode
425			}
426			tracing.EndSpan(ctx, sc, err)
427		}()
428	}
429	req, err := client.ImportPreparer(ctx, appID, luisApp, versionID)
430	if err != nil {
431		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Import", nil, "Failure preparing request")
432		return
433	}
434
435	resp, err := client.ImportSender(req)
436	if err != nil {
437		result.Response = autorest.Response{Response: resp}
438		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Import", resp, "Failure sending request")
439		return
440	}
441
442	result, err = client.ImportResponder(resp)
443	if err != nil {
444		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Import", resp, "Failure responding to request")
445	}
446
447	return
448}
449
450// ImportPreparer prepares the Import request.
451func (client VersionsClient) ImportPreparer(ctx context.Context, appID uuid.UUID, luisApp LuisApp, versionID string) (*http.Request, error) {
452	urlParameters := map[string]interface{}{
453		"Endpoint": client.Endpoint,
454	}
455
456	pathParameters := map[string]interface{}{
457		"appId": autorest.Encode("path", appID),
458	}
459
460	queryParameters := map[string]interface{}{}
461	if len(versionID) > 0 {
462		queryParameters["versionId"] = autorest.Encode("query", versionID)
463	}
464
465	preparer := autorest.CreatePreparer(
466		autorest.AsContentType("application/json; charset=utf-8"),
467		autorest.AsPost(),
468		autorest.WithCustomBaseURL("{Endpoint}/luis/api/v2.0", urlParameters),
469		autorest.WithPathParameters("/apps/{appId}/versions/import", pathParameters),
470		autorest.WithJSON(luisApp),
471		autorest.WithQueryParameters(queryParameters))
472	return preparer.Prepare((&http.Request{}).WithContext(ctx))
473}
474
475// ImportSender sends the Import request. The method will close the
476// http.Response Body if it receives an error.
477func (client VersionsClient) ImportSender(req *http.Request) (*http.Response, error) {
478	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
479}
480
481// ImportResponder handles the response to the Import request. The method always
482// closes the http.Response Body.
483func (client VersionsClient) ImportResponder(resp *http.Response) (result String, err error) {
484	err = autorest.Respond(
485		resp,
486		client.ByInspecting(),
487		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
488		autorest.ByUnmarshallingJSON(&result.Value),
489		autorest.ByClosing())
490	result.Response = autorest.Response{Response: resp}
491	return
492}
493
494// List gets a list of versions for this application ID.
495// Parameters:
496// appID - the application ID.
497// skip - the number of entries to skip. Default value is 0.
498// take - the number of entries to return. Maximum page size is 500. Default is 100.
499func (client VersionsClient) List(ctx context.Context, appID uuid.UUID, skip *int32, take *int32) (result ListVersionInfo, err error) {
500	if tracing.IsEnabled() {
501		ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.List")
502		defer func() {
503			sc := -1
504			if result.Response.Response != nil {
505				sc = result.Response.Response.StatusCode
506			}
507			tracing.EndSpan(ctx, sc, err)
508		}()
509	}
510	if err := validation.Validate([]validation.Validation{
511		{TargetValue: skip,
512			Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false,
513				Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}},
514		{TargetValue: take,
515			Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false,
516				Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(500), Chain: nil},
517					{Target: "take", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
518				}}}}}); err != nil {
519		return result, validation.NewError("authoring.VersionsClient", "List", err.Error())
520	}
521
522	req, err := client.ListPreparer(ctx, appID, skip, take)
523	if err != nil {
524		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "List", nil, "Failure preparing request")
525		return
526	}
527
528	resp, err := client.ListSender(req)
529	if err != nil {
530		result.Response = autorest.Response{Response: resp}
531		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "List", resp, "Failure sending request")
532		return
533	}
534
535	result, err = client.ListResponder(resp)
536	if err != nil {
537		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "List", resp, "Failure responding to request")
538	}
539
540	return
541}
542
543// ListPreparer prepares the List request.
544func (client VersionsClient) ListPreparer(ctx context.Context, appID uuid.UUID, skip *int32, take *int32) (*http.Request, error) {
545	urlParameters := map[string]interface{}{
546		"Endpoint": client.Endpoint,
547	}
548
549	pathParameters := map[string]interface{}{
550		"appId": autorest.Encode("path", appID),
551	}
552
553	queryParameters := map[string]interface{}{}
554	if skip != nil {
555		queryParameters["skip"] = autorest.Encode("query", *skip)
556	} else {
557		queryParameters["skip"] = autorest.Encode("query", 0)
558	}
559	if take != nil {
560		queryParameters["take"] = autorest.Encode("query", *take)
561	} else {
562		queryParameters["take"] = autorest.Encode("query", 100)
563	}
564
565	preparer := autorest.CreatePreparer(
566		autorest.AsGet(),
567		autorest.WithCustomBaseURL("{Endpoint}/luis/api/v2.0", urlParameters),
568		autorest.WithPathParameters("/apps/{appId}/versions", pathParameters),
569		autorest.WithQueryParameters(queryParameters))
570	return preparer.Prepare((&http.Request{}).WithContext(ctx))
571}
572
573// ListSender sends the List request. The method will close the
574// http.Response Body if it receives an error.
575func (client VersionsClient) ListSender(req *http.Request) (*http.Response, error) {
576	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
577}
578
579// ListResponder handles the response to the List request. The method always
580// closes the http.Response Body.
581func (client VersionsClient) ListResponder(resp *http.Response) (result ListVersionInfo, err error) {
582	err = autorest.Respond(
583		resp,
584		client.ByInspecting(),
585		azure.WithErrorUnlessStatusCode(http.StatusOK),
586		autorest.ByUnmarshallingJSON(&result.Value),
587		autorest.ByClosing())
588	result.Response = autorest.Response{Response: resp}
589	return
590}
591
592// Update updates the name or description of the application version.
593// Parameters:
594// appID - the application ID.
595// versionID - the version ID.
596// versionUpdateObject - a model containing Name and Description of the application.
597func (client VersionsClient) Update(ctx context.Context, appID uuid.UUID, versionID string, versionUpdateObject TaskUpdateObject) (result OperationStatus, err error) {
598	if tracing.IsEnabled() {
599		ctx = tracing.StartSpan(ctx, fqdn+"/VersionsClient.Update")
600		defer func() {
601			sc := -1
602			if result.Response.Response != nil {
603				sc = result.Response.Response.StatusCode
604			}
605			tracing.EndSpan(ctx, sc, err)
606		}()
607	}
608	req, err := client.UpdatePreparer(ctx, appID, versionID, versionUpdateObject)
609	if err != nil {
610		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Update", nil, "Failure preparing request")
611		return
612	}
613
614	resp, err := client.UpdateSender(req)
615	if err != nil {
616		result.Response = autorest.Response{Response: resp}
617		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Update", resp, "Failure sending request")
618		return
619	}
620
621	result, err = client.UpdateResponder(resp)
622	if err != nil {
623		err = autorest.NewErrorWithError(err, "authoring.VersionsClient", "Update", resp, "Failure responding to request")
624	}
625
626	return
627}
628
629// UpdatePreparer prepares the Update request.
630func (client VersionsClient) UpdatePreparer(ctx context.Context, appID uuid.UUID, versionID string, versionUpdateObject TaskUpdateObject) (*http.Request, error) {
631	urlParameters := map[string]interface{}{
632		"Endpoint": client.Endpoint,
633	}
634
635	pathParameters := map[string]interface{}{
636		"appId":     autorest.Encode("path", appID),
637		"versionId": autorest.Encode("path", versionID),
638	}
639
640	preparer := autorest.CreatePreparer(
641		autorest.AsContentType("application/json; charset=utf-8"),
642		autorest.AsPut(),
643		autorest.WithCustomBaseURL("{Endpoint}/luis/api/v2.0", urlParameters),
644		autorest.WithPathParameters("/apps/{appId}/versions/{versionId}/", pathParameters),
645		autorest.WithJSON(versionUpdateObject))
646	return preparer.Prepare((&http.Request{}).WithContext(ctx))
647}
648
649// UpdateSender sends the Update request. The method will close the
650// http.Response Body if it receives an error.
651func (client VersionsClient) UpdateSender(req *http.Request) (*http.Response, error) {
652	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
653}
654
655// UpdateResponder handles the response to the Update request. The method always
656// closes the http.Response Body.
657func (client VersionsClient) UpdateResponder(resp *http.Response) (result OperationStatus, err error) {
658	err = autorest.Respond(
659		resp,
660		client.ByInspecting(),
661		azure.WithErrorUnlessStatusCode(http.StatusOK),
662		autorest.ByUnmarshallingJSON(&result),
663		autorest.ByClosing())
664	result.Response = autorest.Response{Response: resp}
665	return
666}
667