...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v3.4-preview/customvision/training/client.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v3.4-preview/customvision/training

     1  // Package training implements the Azure ARM Training service API version 3.4-preview.
     2  //
     3  //
     4  package training
     5  
     6  // Copyright (c) Microsoft Corporation. All rights reserved.
     7  // Licensed under the MIT License. See License.txt in the project root for license information.
     8  //
     9  // Code generated by Microsoft (R) AutoRest Code Generator.
    10  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
    11  
    12  import (
    13  	"context"
    14  	"github.com/Azure/go-autorest/autorest"
    15  	"github.com/Azure/go-autorest/autorest/azure"
    16  	"github.com/Azure/go-autorest/autorest/validation"
    17  	"github.com/Azure/go-autorest/tracing"
    18  	"github.com/gofrs/uuid"
    19  	"io"
    20  	"net/http"
    21  )
    22  
    23  // BaseClient is the base client for Training.
    24  type BaseClient struct {
    25  	autorest.Client
    26  	Endpoint string
    27  }
    28  
    29  // New creates an instance of the BaseClient client.
    30  func New(endpoint string) BaseClient {
    31  	return NewWithoutDefaults(endpoint)
    32  }
    33  
    34  // NewWithoutDefaults creates an instance of the BaseClient client.
    35  func NewWithoutDefaults(endpoint string) BaseClient {
    36  	return BaseClient{
    37  		Client:   autorest.NewClientWithUserAgent(UserAgent()),
    38  		Endpoint: endpoint,
    39  	}
    40  }
    41  
    42  // CreateImageRegions this API accepts a batch of image regions, and optionally tags, to update existing images with
    43  // region information.
    44  // There is a limit of 64 entries in the batch.
    45  // If all regions are successful created, 200(OK) status code will be returned.
    46  // Otherwise, 207 (Multi-Status) status code will be returned and detail status for each region will be listed in the
    47  // response payload.
    48  // Parameters:
    49  // projectID - the project id.
    50  // batch - batch of image regions which include a tag and bounding box. Limited to 64.
    51  func (client BaseClient) CreateImageRegions(ctx context.Context, projectID uuid.UUID, batch ImageRegionCreateBatch) (result ImageRegionCreateSummary, err error) {
    52  	if tracing.IsEnabled() {
    53  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateImageRegions")
    54  		defer func() {
    55  			sc := -1
    56  			if result.Response.Response != nil {
    57  				sc = result.Response.Response.StatusCode
    58  			}
    59  			tracing.EndSpan(ctx, sc, err)
    60  		}()
    61  	}
    62  	req, err := client.CreateImageRegionsPreparer(ctx, projectID, batch)
    63  	if err != nil {
    64  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImageRegions", nil, "Failure preparing request")
    65  		return
    66  	}
    67  
    68  	resp, err := client.CreateImageRegionsSender(req)
    69  	if err != nil {
    70  		result.Response = autorest.Response{Response: resp}
    71  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImageRegions", resp, "Failure sending request")
    72  		return
    73  	}
    74  
    75  	result, err = client.CreateImageRegionsResponder(resp)
    76  	if err != nil {
    77  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImageRegions", resp, "Failure responding to request")
    78  		return
    79  	}
    80  
    81  	return
    82  }
    83  
    84  // CreateImageRegionsPreparer prepares the CreateImageRegions request.
    85  func (client BaseClient) CreateImageRegionsPreparer(ctx context.Context, projectID uuid.UUID, batch ImageRegionCreateBatch) (*http.Request, error) {
    86  	urlParameters := map[string]interface{}{
    87  		"Endpoint": client.Endpoint,
    88  	}
    89  
    90  	pathParameters := map[string]interface{}{
    91  		"projectId": autorest.Encode("path", projectID),
    92  	}
    93  
    94  	preparer := autorest.CreatePreparer(
    95  		autorest.AsContentType("application/json; charset=utf-8"),
    96  		autorest.AsPost(),
    97  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
    98  		autorest.WithPathParameters("/projects/{projectId}/images/regions", pathParameters),
    99  		autorest.WithJSON(batch))
   100  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   101  }
   102  
   103  // CreateImageRegionsSender sends the CreateImageRegions request. The method will close the
   104  // http.Response Body if it receives an error.
   105  func (client BaseClient) CreateImageRegionsSender(req *http.Request) (*http.Response, error) {
   106  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   107  }
   108  
   109  // CreateImageRegionsResponder handles the response to the CreateImageRegions request. The method always
   110  // closes the http.Response Body.
   111  func (client BaseClient) CreateImageRegionsResponder(resp *http.Response) (result ImageRegionCreateSummary, err error) {
   112  	err = autorest.Respond(
   113  		resp,
   114  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusMultiStatus),
   115  		autorest.ByUnmarshallingJSON(&result),
   116  		autorest.ByClosing())
   117  	result.Response = autorest.Response{Response: resp}
   118  	return
   119  }
   120  
   121  // CreateImagesFromData this API accepts body content as multipart/form-data and application/octet-stream. When using
   122  // multipart
   123  // multiple image files can be sent at once, with a maximum of 64 files.
   124  // If all images are successful created, 200(OK) status code will be returned.
   125  // Otherwise, 207 (Multi-Status) status code will be returned and detail status for each image will be listed in the
   126  // response payload.
   127  // Parameters:
   128  // projectID - the project id.
   129  // imageData - binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB.
   130  // tagIds - the tags ids with which to tag each image. Limited to 20.
   131  func (client BaseClient) CreateImagesFromData(ctx context.Context, projectID uuid.UUID, imageData io.ReadCloser, tagIds []uuid.UUID) (result ImageCreateSummary, err error) {
   132  	if tracing.IsEnabled() {
   133  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateImagesFromData")
   134  		defer func() {
   135  			sc := -1
   136  			if result.Response.Response != nil {
   137  				sc = result.Response.Response.StatusCode
   138  			}
   139  			tracing.EndSpan(ctx, sc, err)
   140  		}()
   141  	}
   142  	if err := validation.Validate([]validation.Validation{
   143  		{TargetValue: tagIds,
   144  			Constraints: []validation.Constraint{{Target: "tagIds", Name: validation.Null, Rule: false,
   145  				Chain: []validation.Constraint{{Target: "tagIds", Name: validation.MaxItems, Rule: 20, Chain: nil},
   146  					{Target: "tagIds", Name: validation.MinItems, Rule: 0, Chain: nil},
   147  				}}}}}); err != nil {
   148  		return result, validation.NewError("training.BaseClient", "CreateImagesFromData", err.Error())
   149  	}
   150  
   151  	req, err := client.CreateImagesFromDataPreparer(ctx, projectID, imageData, tagIds)
   152  	if err != nil {
   153  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromData", nil, "Failure preparing request")
   154  		return
   155  	}
   156  
   157  	resp, err := client.CreateImagesFromDataSender(req)
   158  	if err != nil {
   159  		result.Response = autorest.Response{Response: resp}
   160  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromData", resp, "Failure sending request")
   161  		return
   162  	}
   163  
   164  	result, err = client.CreateImagesFromDataResponder(resp)
   165  	if err != nil {
   166  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromData", resp, "Failure responding to request")
   167  		return
   168  	}
   169  
   170  	return
   171  }
   172  
   173  // CreateImagesFromDataPreparer prepares the CreateImagesFromData request.
   174  func (client BaseClient) CreateImagesFromDataPreparer(ctx context.Context, projectID uuid.UUID, imageData io.ReadCloser, tagIds []uuid.UUID) (*http.Request, error) {
   175  	urlParameters := map[string]interface{}{
   176  		"Endpoint": client.Endpoint,
   177  	}
   178  
   179  	pathParameters := map[string]interface{}{
   180  		"projectId": autorest.Encode("path", projectID),
   181  	}
   182  
   183  	queryParameters := map[string]interface{}{}
   184  	if tagIds != nil && len(tagIds) > 0 {
   185  		queryParameters["tagIds"] = autorest.Encode("query", tagIds, ",")
   186  	}
   187  
   188  	formDataParameters := map[string]interface{}{
   189  		"imageData": imageData,
   190  	}
   191  
   192  	preparer := autorest.CreatePreparer(
   193  		autorest.AsPost(),
   194  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
   195  		autorest.WithPathParameters("/projects/{projectId}/images", pathParameters),
   196  		autorest.WithQueryParameters(queryParameters),
   197  		autorest.WithMultiPartFormData(formDataParameters))
   198  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   199  }
   200  
   201  // CreateImagesFromDataSender sends the CreateImagesFromData request. The method will close the
   202  // http.Response Body if it receives an error.
   203  func (client BaseClient) CreateImagesFromDataSender(req *http.Request) (*http.Response, error) {
   204  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   205  }
   206  
   207  // CreateImagesFromDataResponder handles the response to the CreateImagesFromData request. The method always
   208  // closes the http.Response Body.
   209  func (client BaseClient) CreateImagesFromDataResponder(resp *http.Response) (result ImageCreateSummary, err error) {
   210  	err = autorest.Respond(
   211  		resp,
   212  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusMultiStatus),
   213  		autorest.ByUnmarshallingJSON(&result),
   214  		autorest.ByClosing())
   215  	result.Response = autorest.Response{Response: resp}
   216  	return
   217  }
   218  
   219  // CreateImagesFromFiles this API accepts a batch of files, and optionally tags, to create images. There is a limit of
   220  // 64 images and 20 tags.
   221  // If all images are successful created, 200(OK) status code will be returned.
   222  // Otherwise, 207 (Multi-Status) status code will be returned and detail status for each image will be listed in the
   223  // response payload.
   224  // Parameters:
   225  // projectID - the project id.
   226  // batch - the batch of image files to add. Limited to 64 images and 20 tags per batch.
   227  func (client BaseClient) CreateImagesFromFiles(ctx context.Context, projectID uuid.UUID, batch ImageFileCreateBatch) (result ImageCreateSummary, err error) {
   228  	if tracing.IsEnabled() {
   229  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateImagesFromFiles")
   230  		defer func() {
   231  			sc := -1
   232  			if result.Response.Response != nil {
   233  				sc = result.Response.Response.StatusCode
   234  			}
   235  			tracing.EndSpan(ctx, sc, err)
   236  		}()
   237  	}
   238  	req, err := client.CreateImagesFromFilesPreparer(ctx, projectID, batch)
   239  	if err != nil {
   240  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromFiles", nil, "Failure preparing request")
   241  		return
   242  	}
   243  
   244  	resp, err := client.CreateImagesFromFilesSender(req)
   245  	if err != nil {
   246  		result.Response = autorest.Response{Response: resp}
   247  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromFiles", resp, "Failure sending request")
   248  		return
   249  	}
   250  
   251  	result, err = client.CreateImagesFromFilesResponder(resp)
   252  	if err != nil {
   253  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromFiles", resp, "Failure responding to request")
   254  		return
   255  	}
   256  
   257  	return
   258  }
   259  
   260  // CreateImagesFromFilesPreparer prepares the CreateImagesFromFiles request.
   261  func (client BaseClient) CreateImagesFromFilesPreparer(ctx context.Context, projectID uuid.UUID, batch ImageFileCreateBatch) (*http.Request, error) {
   262  	urlParameters := map[string]interface{}{
   263  		"Endpoint": client.Endpoint,
   264  	}
   265  
   266  	pathParameters := map[string]interface{}{
   267  		"projectId": autorest.Encode("path", projectID),
   268  	}
   269  
   270  	preparer := autorest.CreatePreparer(
   271  		autorest.AsContentType("application/json; charset=utf-8"),
   272  		autorest.AsPost(),
   273  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
   274  		autorest.WithPathParameters("/projects/{projectId}/images/files", pathParameters),
   275  		autorest.WithJSON(batch))
   276  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   277  }
   278  
   279  // CreateImagesFromFilesSender sends the CreateImagesFromFiles request. The method will close the
   280  // http.Response Body if it receives an error.
   281  func (client BaseClient) CreateImagesFromFilesSender(req *http.Request) (*http.Response, error) {
   282  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   283  }
   284  
   285  // CreateImagesFromFilesResponder handles the response to the CreateImagesFromFiles request. The method always
   286  // closes the http.Response Body.
   287  func (client BaseClient) CreateImagesFromFilesResponder(resp *http.Response) (result ImageCreateSummary, err error) {
   288  	err = autorest.Respond(
   289  		resp,
   290  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusMultiStatus),
   291  		autorest.ByUnmarshallingJSON(&result),
   292  		autorest.ByClosing())
   293  	result.Response = autorest.Response{Response: resp}
   294  	return
   295  }
   296  
   297  // CreateImagesFromPredictions this API creates a batch of images from predicted images specified. There is a limit of
   298  // 64 images and 20 tags.
   299  // If all images are successful created, 200(OK) status code will be returned.
   300  // Otherwise, 207 (Multi-Status) status code will be returned and detail status for each image will be listed in the
   301  // response payload.
   302  // Parameters:
   303  // projectID - the project id.
   304  // batch - image, tag ids, and metadata. Limited to 64 images and 20 tags per batch.
   305  func (client BaseClient) CreateImagesFromPredictions(ctx context.Context, projectID uuid.UUID, batch ImageIDCreateBatch) (result ImageCreateSummary, err error) {
   306  	if tracing.IsEnabled() {
   307  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateImagesFromPredictions")
   308  		defer func() {
   309  			sc := -1
   310  			if result.Response.Response != nil {
   311  				sc = result.Response.Response.StatusCode
   312  			}
   313  			tracing.EndSpan(ctx, sc, err)
   314  		}()
   315  	}
   316  	req, err := client.CreateImagesFromPredictionsPreparer(ctx, projectID, batch)
   317  	if err != nil {
   318  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromPredictions", nil, "Failure preparing request")
   319  		return
   320  	}
   321  
   322  	resp, err := client.CreateImagesFromPredictionsSender(req)
   323  	if err != nil {
   324  		result.Response = autorest.Response{Response: resp}
   325  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromPredictions", resp, "Failure sending request")
   326  		return
   327  	}
   328  
   329  	result, err = client.CreateImagesFromPredictionsResponder(resp)
   330  	if err != nil {
   331  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromPredictions", resp, "Failure responding to request")
   332  		return
   333  	}
   334  
   335  	return
   336  }
   337  
   338  // CreateImagesFromPredictionsPreparer prepares the CreateImagesFromPredictions request.
   339  func (client BaseClient) CreateImagesFromPredictionsPreparer(ctx context.Context, projectID uuid.UUID, batch ImageIDCreateBatch) (*http.Request, error) {
   340  	urlParameters := map[string]interface{}{
   341  		"Endpoint": client.Endpoint,
   342  	}
   343  
   344  	pathParameters := map[string]interface{}{
   345  		"projectId": autorest.Encode("path", projectID),
   346  	}
   347  
   348  	preparer := autorest.CreatePreparer(
   349  		autorest.AsContentType("application/json; charset=utf-8"),
   350  		autorest.AsPost(),
   351  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
   352  		autorest.WithPathParameters("/projects/{projectId}/images/predictions", pathParameters),
   353  		autorest.WithJSON(batch))
   354  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   355  }
   356  
   357  // CreateImagesFromPredictionsSender sends the CreateImagesFromPredictions request. The method will close the
   358  // http.Response Body if it receives an error.
   359  func (client BaseClient) CreateImagesFromPredictionsSender(req *http.Request) (*http.Response, error) {
   360  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   361  }
   362  
   363  // CreateImagesFromPredictionsResponder handles the response to the CreateImagesFromPredictions request. The method always
   364  // closes the http.Response Body.
   365  func (client BaseClient) CreateImagesFromPredictionsResponder(resp *http.Response) (result ImageCreateSummary, err error) {
   366  	err = autorest.Respond(
   367  		resp,
   368  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusMultiStatus),
   369  		autorest.ByUnmarshallingJSON(&result),
   370  		autorest.ByClosing())
   371  	result.Response = autorest.Response{Response: resp}
   372  	return
   373  }
   374  
   375  // CreateImagesFromUrls this API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64
   376  // images and 20 tags.
   377  // If all images are successful created, 200(OK) status code will be returned.
   378  // Otherwise, 207 (Multi-Status) status code will be returned and detail status for each image will be listed in the
   379  // response payload.
   380  // Parameters:
   381  // projectID - the project id.
   382  // batch - image urls, tag ids, and metadata. Limited to 64 images and 20 tags per batch.
   383  func (client BaseClient) CreateImagesFromUrls(ctx context.Context, projectID uuid.UUID, batch ImageURLCreateBatch) (result ImageCreateSummary, err error) {
   384  	if tracing.IsEnabled() {
   385  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateImagesFromUrls")
   386  		defer func() {
   387  			sc := -1
   388  			if result.Response.Response != nil {
   389  				sc = result.Response.Response.StatusCode
   390  			}
   391  			tracing.EndSpan(ctx, sc, err)
   392  		}()
   393  	}
   394  	req, err := client.CreateImagesFromUrlsPreparer(ctx, projectID, batch)
   395  	if err != nil {
   396  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromUrls", nil, "Failure preparing request")
   397  		return
   398  	}
   399  
   400  	resp, err := client.CreateImagesFromUrlsSender(req)
   401  	if err != nil {
   402  		result.Response = autorest.Response{Response: resp}
   403  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromUrls", resp, "Failure sending request")
   404  		return
   405  	}
   406  
   407  	result, err = client.CreateImagesFromUrlsResponder(resp)
   408  	if err != nil {
   409  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImagesFromUrls", resp, "Failure responding to request")
   410  		return
   411  	}
   412  
   413  	return
   414  }
   415  
   416  // CreateImagesFromUrlsPreparer prepares the CreateImagesFromUrls request.
   417  func (client BaseClient) CreateImagesFromUrlsPreparer(ctx context.Context, projectID uuid.UUID, batch ImageURLCreateBatch) (*http.Request, error) {
   418  	urlParameters := map[string]interface{}{
   419  		"Endpoint": client.Endpoint,
   420  	}
   421  
   422  	pathParameters := map[string]interface{}{
   423  		"projectId": autorest.Encode("path", projectID),
   424  	}
   425  
   426  	preparer := autorest.CreatePreparer(
   427  		autorest.AsContentType("application/json; charset=utf-8"),
   428  		autorest.AsPost(),
   429  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
   430  		autorest.WithPathParameters("/projects/{projectId}/images/urls", pathParameters),
   431  		autorest.WithJSON(batch))
   432  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   433  }
   434  
   435  // CreateImagesFromUrlsSender sends the CreateImagesFromUrls request. The method will close the
   436  // http.Response Body if it receives an error.
   437  func (client BaseClient) CreateImagesFromUrlsSender(req *http.Request) (*http.Response, error) {
   438  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   439  }
   440  
   441  // CreateImagesFromUrlsResponder handles the response to the CreateImagesFromUrls request. The method always
   442  // closes the http.Response Body.
   443  func (client BaseClient) CreateImagesFromUrlsResponder(resp *http.Response) (result ImageCreateSummary, err error) {
   444  	err = autorest.Respond(
   445  		resp,
   446  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusMultiStatus),
   447  		autorest.ByUnmarshallingJSON(&result),
   448  		autorest.ByClosing())
   449  	result.Response = autorest.Response{Response: resp}
   450  	return
   451  }
   452  
   453  // CreateImageTags sends the create image tags request.
   454  // Parameters:
   455  // projectID - the project id.
   456  // batch - batch of image tags. Limited to 128 tags per batch.
   457  func (client BaseClient) CreateImageTags(ctx context.Context, projectID uuid.UUID, batch ImageTagCreateBatch) (result ImageTagCreateSummary, err error) {
   458  	if tracing.IsEnabled() {
   459  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateImageTags")
   460  		defer func() {
   461  			sc := -1
   462  			if result.Response.Response != nil {
   463  				sc = result.Response.Response.StatusCode
   464  			}
   465  			tracing.EndSpan(ctx, sc, err)
   466  		}()
   467  	}
   468  	req, err := client.CreateImageTagsPreparer(ctx, projectID, batch)
   469  	if err != nil {
   470  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImageTags", nil, "Failure preparing request")
   471  		return
   472  	}
   473  
   474  	resp, err := client.CreateImageTagsSender(req)
   475  	if err != nil {
   476  		result.Response = autorest.Response{Response: resp}
   477  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImageTags", resp, "Failure sending request")
   478  		return
   479  	}
   480  
   481  	result, err = client.CreateImageTagsResponder(resp)
   482  	if err != nil {
   483  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateImageTags", resp, "Failure responding to request")
   484  		return
   485  	}
   486  
   487  	return
   488  }
   489  
   490  // CreateImageTagsPreparer prepares the CreateImageTags request.
   491  func (client BaseClient) CreateImageTagsPreparer(ctx context.Context, projectID uuid.UUID, batch ImageTagCreateBatch) (*http.Request, error) {
   492  	urlParameters := map[string]interface{}{
   493  		"Endpoint": client.Endpoint,
   494  	}
   495  
   496  	pathParameters := map[string]interface{}{
   497  		"projectId": autorest.Encode("path", projectID),
   498  	}
   499  
   500  	preparer := autorest.CreatePreparer(
   501  		autorest.AsContentType("application/json; charset=utf-8"),
   502  		autorest.AsPost(),
   503  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
   504  		autorest.WithPathParameters("/projects/{projectId}/images/tags", pathParameters),
   505  		autorest.WithJSON(batch))
   506  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   507  }
   508  
   509  // CreateImageTagsSender sends the CreateImageTags request. The method will close the
   510  // http.Response Body if it receives an error.
   511  func (client BaseClient) CreateImageTagsSender(req *http.Request) (*http.Response, error) {
   512  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   513  }
   514  
   515  // CreateImageTagsResponder handles the response to the CreateImageTags request. The method always
   516  // closes the http.Response Body.
   517  func (client BaseClient) CreateImageTagsResponder(resp *http.Response) (result ImageTagCreateSummary, 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  // CreateProject sends the create project request.
   528  // Parameters:
   529  // name - name of the project.
   530  // description - the description of the project.
   531  // domainID - the id of the domain to use for this project. Defaults to General.
   532  // classificationType - the type of classifier to create for this project.
   533  // targetExportPlatforms - list of platforms the trained model is intending exporting to.
   534  // options - additional project creation options.
   535  func (client BaseClient) CreateProject(ctx context.Context, name string, description string, domainID *uuid.UUID, classificationType string, targetExportPlatforms []string, options *CreateProjectOptions) (result Project, err error) {
   536  	if tracing.IsEnabled() {
   537  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateProject")
   538  		defer func() {
   539  			sc := -1
   540  			if result.Response.Response != nil {
   541  				sc = result.Response.Response.StatusCode
   542  			}
   543  			tracing.EndSpan(ctx, sc, err)
   544  		}()
   545  	}
   546  	req, err := client.CreateProjectPreparer(ctx, name, description, domainID, classificationType, targetExportPlatforms, options)
   547  	if err != nil {
   548  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateProject", nil, "Failure preparing request")
   549  		return
   550  	}
   551  
   552  	resp, err := client.CreateProjectSender(req)
   553  	if err != nil {
   554  		result.Response = autorest.Response{Response: resp}
   555  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateProject", resp, "Failure sending request")
   556  		return
   557  	}
   558  
   559  	result, err = client.CreateProjectResponder(resp)
   560  	if err != nil {
   561  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateProject", resp, "Failure responding to request")
   562  		return
   563  	}
   564  
   565  	return
   566  }
   567  
   568  // CreateProjectPreparer prepares the CreateProject request.
   569  func (client BaseClient) CreateProjectPreparer(ctx context.Context, name string, description string, domainID *uuid.UUID, classificationType string, targetExportPlatforms []string, options *CreateProjectOptions) (*http.Request, error) {
   570  	urlParameters := map[string]interface{}{
   571  		"Endpoint": client.Endpoint,
   572  	}
   573  
   574  	queryParameters := map[string]interface{}{
   575  		"name": autorest.Encode("query", name),
   576  	}
   577  	if len(description) > 0 {
   578  		queryParameters["description"] = autorest.Encode("query", description)
   579  	}
   580  	if domainID != nil {
   581  		queryParameters["domainId"] = autorest.Encode("query", *domainID)
   582  	}
   583  	if len(string(classificationType)) > 0 {
   584  		queryParameters["classificationType"] = autorest.Encode("query", classificationType)
   585  	}
   586  	if targetExportPlatforms != nil && len(targetExportPlatforms) > 0 {
   587  		queryParameters["targetExportPlatforms"] = autorest.Encode("query", targetExportPlatforms, ",")
   588  	}
   589  
   590  	preparer := autorest.CreatePreparer(
   591  		autorest.AsContentType("application/json; charset=utf-8"),
   592  		autorest.AsPost(),
   593  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
   594  		autorest.WithPath("/projects"),
   595  		autorest.WithQueryParameters(queryParameters))
   596  	if options != nil {
   597  		preparer = autorest.DecoratePreparer(preparer,
   598  			autorest.WithJSON(options))
   599  	}
   600  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   601  }
   602  
   603  // CreateProjectSender sends the CreateProject request. The method will close the
   604  // http.Response Body if it receives an error.
   605  func (client BaseClient) CreateProjectSender(req *http.Request) (*http.Response, error) {
   606  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   607  }
   608  
   609  // CreateProjectResponder handles the response to the CreateProject request. The method always
   610  // closes the http.Response Body.
   611  func (client BaseClient) CreateProjectResponder(resp *http.Response) (result Project, 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  // CreateTag sends the create tag request.
   622  // Parameters:
   623  // projectID - the project id.
   624  // name - the tag name.
   625  // description - optional description for the tag.
   626  // typeParameter - optional type for the tag.
   627  func (client BaseClient) CreateTag(ctx context.Context, projectID uuid.UUID, name string, description string, typeParameter string) (result Tag, err error) {
   628  	if tracing.IsEnabled() {
   629  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateTag")
   630  		defer func() {
   631  			sc := -1
   632  			if result.Response.Response != nil {
   633  				sc = result.Response.Response.StatusCode
   634  			}
   635  			tracing.EndSpan(ctx, sc, err)
   636  		}()
   637  	}
   638  	req, err := client.CreateTagPreparer(ctx, projectID, name, description, typeParameter)
   639  	if err != nil {
   640  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateTag", nil, "Failure preparing request")
   641  		return
   642  	}
   643  
   644  	resp, err := client.CreateTagSender(req)
   645  	if err != nil {
   646  		result.Response = autorest.Response{Response: resp}
   647  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateTag", resp, "Failure sending request")
   648  		return
   649  	}
   650  
   651  	result, err = client.CreateTagResponder(resp)
   652  	if err != nil {
   653  		err = autorest.NewErrorWithError(err, "training.BaseClient", "CreateTag", resp, "Failure responding to request")
   654  		return
   655  	}
   656  
   657  	return
   658  }
   659  
   660  // CreateTagPreparer prepares the CreateTag request.
   661  func (client BaseClient) CreateTagPreparer(ctx context.Context, projectID uuid.UUID, name string, description string, typeParameter string) (*http.Request, error) {
   662  	urlParameters := map[string]interface{}{
   663  		"Endpoint": client.Endpoint,
   664  	}
   665  
   666  	pathParameters := map[string]interface{}{
   667  		"projectId": autorest.Encode("path", projectID),
   668  	}
   669  
   670  	queryParameters := map[string]interface{}{
   671  		"name": autorest.Encode("query", name),
   672  	}
   673  	if len(description) > 0 {
   674  		queryParameters["description"] = autorest.Encode("query", description)
   675  	}
   676  	if len(string(typeParameter)) > 0 {
   677  		queryParameters["type"] = autorest.Encode("query", typeParameter)
   678  	}
   679  
   680  	preparer := autorest.CreatePreparer(
   681  		autorest.AsPost(),
   682  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
   683  		autorest.WithPathParameters("/projects/{projectId}/tags", pathParameters),
   684  		autorest.WithQueryParameters(queryParameters))
   685  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   686  }
   687  
   688  // CreateTagSender sends the CreateTag request. The method will close the
   689  // http.Response Body if it receives an error.
   690  func (client BaseClient) CreateTagSender(req *http.Request) (*http.Response, error) {
   691  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   692  }
   693  
   694  // CreateTagResponder handles the response to the CreateTag request. The method always
   695  // closes the http.Response Body.
   696  func (client BaseClient) CreateTagResponder(resp *http.Response) (result Tag, err error) {
   697  	err = autorest.Respond(
   698  		resp,
   699  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   700  		autorest.ByUnmarshallingJSON(&result),
   701  		autorest.ByClosing())
   702  	result.Response = autorest.Response{Response: resp}
   703  	return
   704  }
   705  
   706  // DeleteImageRegions sends the delete image regions request.
   707  // Parameters:
   708  // projectID - the project id.
   709  // regionIds - regions to delete. Limited to 64.
   710  func (client BaseClient) DeleteImageRegions(ctx context.Context, projectID uuid.UUID, regionIds []uuid.UUID) (result autorest.Response, err error) {
   711  	if tracing.IsEnabled() {
   712  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteImageRegions")
   713  		defer func() {
   714  			sc := -1
   715  			if result.Response != nil {
   716  				sc = result.Response.StatusCode
   717  			}
   718  			tracing.EndSpan(ctx, sc, err)
   719  		}()
   720  	}
   721  	if err := validation.Validate([]validation.Validation{
   722  		{TargetValue: regionIds,
   723  			Constraints: []validation.Constraint{{Target: "regionIds", Name: validation.Null, Rule: true,
   724  				Chain: []validation.Constraint{{Target: "regionIds", Name: validation.MaxItems, Rule: 64, Chain: nil},
   725  					{Target: "regionIds", Name: validation.MinItems, Rule: 0, Chain: nil},
   726  				}}}}}); err != nil {
   727  		return result, validation.NewError("training.BaseClient", "DeleteImageRegions", err.Error())
   728  	}
   729  
   730  	req, err := client.DeleteImageRegionsPreparer(ctx, projectID, regionIds)
   731  	if err != nil {
   732  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteImageRegions", nil, "Failure preparing request")
   733  		return
   734  	}
   735  
   736  	resp, err := client.DeleteImageRegionsSender(req)
   737  	if err != nil {
   738  		result.Response = resp
   739  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteImageRegions", resp, "Failure sending request")
   740  		return
   741  	}
   742  
   743  	result, err = client.DeleteImageRegionsResponder(resp)
   744  	if err != nil {
   745  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteImageRegions", resp, "Failure responding to request")
   746  		return
   747  	}
   748  
   749  	return
   750  }
   751  
   752  // DeleteImageRegionsPreparer prepares the DeleteImageRegions request.
   753  func (client BaseClient) DeleteImageRegionsPreparer(ctx context.Context, projectID uuid.UUID, regionIds []uuid.UUID) (*http.Request, error) {
   754  	urlParameters := map[string]interface{}{
   755  		"Endpoint": client.Endpoint,
   756  	}
   757  
   758  	pathParameters := map[string]interface{}{
   759  		"projectId": autorest.Encode("path", projectID),
   760  	}
   761  
   762  	queryParameters := map[string]interface{}{
   763  		"regionIds": autorest.Encode("query", regionIds, ","),
   764  	}
   765  
   766  	preparer := autorest.CreatePreparer(
   767  		autorest.AsDelete(),
   768  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
   769  		autorest.WithPathParameters("/projects/{projectId}/images/regions", pathParameters),
   770  		autorest.WithQueryParameters(queryParameters))
   771  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   772  }
   773  
   774  // DeleteImageRegionsSender sends the DeleteImageRegions request. The method will close the
   775  // http.Response Body if it receives an error.
   776  func (client BaseClient) DeleteImageRegionsSender(req *http.Request) (*http.Response, error) {
   777  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   778  }
   779  
   780  // DeleteImageRegionsResponder handles the response to the DeleteImageRegions request. The method always
   781  // closes the http.Response Body.
   782  func (client BaseClient) DeleteImageRegionsResponder(resp *http.Response) (result autorest.Response, err error) {
   783  	err = autorest.Respond(
   784  		resp,
   785  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   786  		autorest.ByClosing())
   787  	result.Response = resp
   788  	return
   789  }
   790  
   791  // DeleteImages sends the delete images request.
   792  // Parameters:
   793  // projectID - the project id.
   794  // imageIds - ids of the images to be deleted. Limited to 256 images per batch.
   795  // allImages - flag to specify delete all images, specify this flag or a list of images. Using this flag will
   796  // return a 202 response to indicate the images are being deleted.
   797  // allIterations - removes these images from all iterations, not just the current workspace. Using this flag
   798  // will return a 202 response to indicate the images are being deleted.
   799  func (client BaseClient) DeleteImages(ctx context.Context, projectID uuid.UUID, imageIds []uuid.UUID, allImages *bool, allIterations *bool) (result autorest.Response, err error) {
   800  	if tracing.IsEnabled() {
   801  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteImages")
   802  		defer func() {
   803  			sc := -1
   804  			if result.Response != nil {
   805  				sc = result.Response.StatusCode
   806  			}
   807  			tracing.EndSpan(ctx, sc, err)
   808  		}()
   809  	}
   810  	if err := validation.Validate([]validation.Validation{
   811  		{TargetValue: imageIds,
   812  			Constraints: []validation.Constraint{{Target: "imageIds", Name: validation.Null, Rule: false,
   813  				Chain: []validation.Constraint{{Target: "imageIds", Name: validation.MaxItems, Rule: 256, Chain: nil},
   814  					{Target: "imageIds", Name: validation.MinItems, Rule: 0, Chain: nil},
   815  				}}}}}); err != nil {
   816  		return result, validation.NewError("training.BaseClient", "DeleteImages", err.Error())
   817  	}
   818  
   819  	req, err := client.DeleteImagesPreparer(ctx, projectID, imageIds, allImages, allIterations)
   820  	if err != nil {
   821  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteImages", nil, "Failure preparing request")
   822  		return
   823  	}
   824  
   825  	resp, err := client.DeleteImagesSender(req)
   826  	if err != nil {
   827  		result.Response = resp
   828  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteImages", resp, "Failure sending request")
   829  		return
   830  	}
   831  
   832  	result, err = client.DeleteImagesResponder(resp)
   833  	if err != nil {
   834  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteImages", resp, "Failure responding to request")
   835  		return
   836  	}
   837  
   838  	return
   839  }
   840  
   841  // DeleteImagesPreparer prepares the DeleteImages request.
   842  func (client BaseClient) DeleteImagesPreparer(ctx context.Context, projectID uuid.UUID, imageIds []uuid.UUID, allImages *bool, allIterations *bool) (*http.Request, error) {
   843  	urlParameters := map[string]interface{}{
   844  		"Endpoint": client.Endpoint,
   845  	}
   846  
   847  	pathParameters := map[string]interface{}{
   848  		"projectId": autorest.Encode("path", projectID),
   849  	}
   850  
   851  	queryParameters := map[string]interface{}{}
   852  	if imageIds != nil && len(imageIds) > 0 {
   853  		queryParameters["imageIds"] = autorest.Encode("query", imageIds, ",")
   854  	}
   855  	if allImages != nil {
   856  		queryParameters["allImages"] = autorest.Encode("query", *allImages)
   857  	}
   858  	if allIterations != nil {
   859  		queryParameters["allIterations"] = autorest.Encode("query", *allIterations)
   860  	}
   861  
   862  	preparer := autorest.CreatePreparer(
   863  		autorest.AsDelete(),
   864  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
   865  		autorest.WithPathParameters("/projects/{projectId}/images", pathParameters),
   866  		autorest.WithQueryParameters(queryParameters))
   867  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   868  }
   869  
   870  // DeleteImagesSender sends the DeleteImages request. The method will close the
   871  // http.Response Body if it receives an error.
   872  func (client BaseClient) DeleteImagesSender(req *http.Request) (*http.Response, error) {
   873  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   874  }
   875  
   876  // DeleteImagesResponder handles the response to the DeleteImages request. The method always
   877  // closes the http.Response Body.
   878  func (client BaseClient) DeleteImagesResponder(resp *http.Response) (result autorest.Response, err error) {
   879  	err = autorest.Respond(
   880  		resp,
   881  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   882  		autorest.ByClosing())
   883  	result.Response = resp
   884  	return
   885  }
   886  
   887  // DeleteImageTags sends the delete image tags request.
   888  // Parameters:
   889  // projectID - the project id.
   890  // imageIds - image ids. Limited to 64 images.
   891  // tagIds - tags to be deleted from the specified images. Limited to 20 tags.
   892  func (client BaseClient) DeleteImageTags(ctx context.Context, projectID uuid.UUID, imageIds []uuid.UUID, tagIds []uuid.UUID) (result autorest.Response, err error) {
   893  	if tracing.IsEnabled() {
   894  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteImageTags")
   895  		defer func() {
   896  			sc := -1
   897  			if result.Response != nil {
   898  				sc = result.Response.StatusCode
   899  			}
   900  			tracing.EndSpan(ctx, sc, err)
   901  		}()
   902  	}
   903  	if err := validation.Validate([]validation.Validation{
   904  		{TargetValue: imageIds,
   905  			Constraints: []validation.Constraint{{Target: "imageIds", Name: validation.Null, Rule: true,
   906  				Chain: []validation.Constraint{{Target: "imageIds", Name: validation.MaxItems, Rule: 64, Chain: nil},
   907  					{Target: "imageIds", Name: validation.MinItems, Rule: 0, Chain: nil},
   908  				}}}},
   909  		{TargetValue: tagIds,
   910  			Constraints: []validation.Constraint{{Target: "tagIds", Name: validation.Null, Rule: true,
   911  				Chain: []validation.Constraint{{Target: "tagIds", Name: validation.MaxItems, Rule: 20, Chain: nil},
   912  					{Target: "tagIds", Name: validation.MinItems, Rule: 0, Chain: nil},
   913  				}}}}}); err != nil {
   914  		return result, validation.NewError("training.BaseClient", "DeleteImageTags", err.Error())
   915  	}
   916  
   917  	req, err := client.DeleteImageTagsPreparer(ctx, projectID, imageIds, tagIds)
   918  	if err != nil {
   919  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteImageTags", nil, "Failure preparing request")
   920  		return
   921  	}
   922  
   923  	resp, err := client.DeleteImageTagsSender(req)
   924  	if err != nil {
   925  		result.Response = resp
   926  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteImageTags", resp, "Failure sending request")
   927  		return
   928  	}
   929  
   930  	result, err = client.DeleteImageTagsResponder(resp)
   931  	if err != nil {
   932  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteImageTags", resp, "Failure responding to request")
   933  		return
   934  	}
   935  
   936  	return
   937  }
   938  
   939  // DeleteImageTagsPreparer prepares the DeleteImageTags request.
   940  func (client BaseClient) DeleteImageTagsPreparer(ctx context.Context, projectID uuid.UUID, imageIds []uuid.UUID, tagIds []uuid.UUID) (*http.Request, error) {
   941  	urlParameters := map[string]interface{}{
   942  		"Endpoint": client.Endpoint,
   943  	}
   944  
   945  	pathParameters := map[string]interface{}{
   946  		"projectId": autorest.Encode("path", projectID),
   947  	}
   948  
   949  	queryParameters := map[string]interface{}{
   950  		"imageIds": autorest.Encode("query", imageIds, ","),
   951  		"tagIds":   autorest.Encode("query", tagIds, ","),
   952  	}
   953  
   954  	preparer := autorest.CreatePreparer(
   955  		autorest.AsDelete(),
   956  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
   957  		autorest.WithPathParameters("/projects/{projectId}/images/tags", pathParameters),
   958  		autorest.WithQueryParameters(queryParameters))
   959  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   960  }
   961  
   962  // DeleteImageTagsSender sends the DeleteImageTags request. The method will close the
   963  // http.Response Body if it receives an error.
   964  func (client BaseClient) DeleteImageTagsSender(req *http.Request) (*http.Response, error) {
   965  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
   966  }
   967  
   968  // DeleteImageTagsResponder handles the response to the DeleteImageTags request. The method always
   969  // closes the http.Response Body.
   970  func (client BaseClient) DeleteImageTagsResponder(resp *http.Response) (result autorest.Response, err error) {
   971  	err = autorest.Respond(
   972  		resp,
   973  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   974  		autorest.ByClosing())
   975  	result.Response = resp
   976  	return
   977  }
   978  
   979  // DeleteIteration sends the delete iteration request.
   980  // Parameters:
   981  // projectID - the project id.
   982  // iterationID - the iteration id.
   983  func (client BaseClient) DeleteIteration(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID) (result autorest.Response, err error) {
   984  	if tracing.IsEnabled() {
   985  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteIteration")
   986  		defer func() {
   987  			sc := -1
   988  			if result.Response != nil {
   989  				sc = result.Response.StatusCode
   990  			}
   991  			tracing.EndSpan(ctx, sc, err)
   992  		}()
   993  	}
   994  	req, err := client.DeleteIterationPreparer(ctx, projectID, iterationID)
   995  	if err != nil {
   996  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteIteration", nil, "Failure preparing request")
   997  		return
   998  	}
   999  
  1000  	resp, err := client.DeleteIterationSender(req)
  1001  	if err != nil {
  1002  		result.Response = resp
  1003  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteIteration", resp, "Failure sending request")
  1004  		return
  1005  	}
  1006  
  1007  	result, err = client.DeleteIterationResponder(resp)
  1008  	if err != nil {
  1009  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteIteration", resp, "Failure responding to request")
  1010  		return
  1011  	}
  1012  
  1013  	return
  1014  }
  1015  
  1016  // DeleteIterationPreparer prepares the DeleteIteration request.
  1017  func (client BaseClient) DeleteIterationPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID) (*http.Request, error) {
  1018  	urlParameters := map[string]interface{}{
  1019  		"Endpoint": client.Endpoint,
  1020  	}
  1021  
  1022  	pathParameters := map[string]interface{}{
  1023  		"iterationId": autorest.Encode("path", iterationID),
  1024  		"projectId":   autorest.Encode("path", projectID),
  1025  	}
  1026  
  1027  	preparer := autorest.CreatePreparer(
  1028  		autorest.AsDelete(),
  1029  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1030  		autorest.WithPathParameters("/projects/{projectId}/iterations/{iterationId}", pathParameters))
  1031  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1032  }
  1033  
  1034  // DeleteIterationSender sends the DeleteIteration request. The method will close the
  1035  // http.Response Body if it receives an error.
  1036  func (client BaseClient) DeleteIterationSender(req *http.Request) (*http.Response, error) {
  1037  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1038  }
  1039  
  1040  // DeleteIterationResponder handles the response to the DeleteIteration request. The method always
  1041  // closes the http.Response Body.
  1042  func (client BaseClient) DeleteIterationResponder(resp *http.Response) (result autorest.Response, err error) {
  1043  	err = autorest.Respond(
  1044  		resp,
  1045  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
  1046  		autorest.ByClosing())
  1047  	result.Response = resp
  1048  	return
  1049  }
  1050  
  1051  // DeletePrediction sends the delete prediction request.
  1052  // Parameters:
  1053  // projectID - the project id.
  1054  // ids - the prediction ids. Limited to 64.
  1055  func (client BaseClient) DeletePrediction(ctx context.Context, projectID uuid.UUID, ids []uuid.UUID) (result autorest.Response, err error) {
  1056  	if tracing.IsEnabled() {
  1057  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeletePrediction")
  1058  		defer func() {
  1059  			sc := -1
  1060  			if result.Response != nil {
  1061  				sc = result.Response.StatusCode
  1062  			}
  1063  			tracing.EndSpan(ctx, sc, err)
  1064  		}()
  1065  	}
  1066  	if err := validation.Validate([]validation.Validation{
  1067  		{TargetValue: ids,
  1068  			Constraints: []validation.Constraint{{Target: "ids", Name: validation.Null, Rule: true,
  1069  				Chain: []validation.Constraint{{Target: "ids", Name: validation.MaxItems, Rule: 64, Chain: nil},
  1070  					{Target: "ids", Name: validation.MinItems, Rule: 0, Chain: nil},
  1071  				}}}}}); err != nil {
  1072  		return result, validation.NewError("training.BaseClient", "DeletePrediction", err.Error())
  1073  	}
  1074  
  1075  	req, err := client.DeletePredictionPreparer(ctx, projectID, ids)
  1076  	if err != nil {
  1077  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeletePrediction", nil, "Failure preparing request")
  1078  		return
  1079  	}
  1080  
  1081  	resp, err := client.DeletePredictionSender(req)
  1082  	if err != nil {
  1083  		result.Response = resp
  1084  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeletePrediction", resp, "Failure sending request")
  1085  		return
  1086  	}
  1087  
  1088  	result, err = client.DeletePredictionResponder(resp)
  1089  	if err != nil {
  1090  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeletePrediction", resp, "Failure responding to request")
  1091  		return
  1092  	}
  1093  
  1094  	return
  1095  }
  1096  
  1097  // DeletePredictionPreparer prepares the DeletePrediction request.
  1098  func (client BaseClient) DeletePredictionPreparer(ctx context.Context, projectID uuid.UUID, ids []uuid.UUID) (*http.Request, error) {
  1099  	urlParameters := map[string]interface{}{
  1100  		"Endpoint": client.Endpoint,
  1101  	}
  1102  
  1103  	pathParameters := map[string]interface{}{
  1104  		"projectId": autorest.Encode("path", projectID),
  1105  	}
  1106  
  1107  	queryParameters := map[string]interface{}{
  1108  		"ids": autorest.Encode("query", ids, ","),
  1109  	}
  1110  
  1111  	preparer := autorest.CreatePreparer(
  1112  		autorest.AsDelete(),
  1113  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1114  		autorest.WithPathParameters("/projects/{projectId}/predictions", pathParameters),
  1115  		autorest.WithQueryParameters(queryParameters))
  1116  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1117  }
  1118  
  1119  // DeletePredictionSender sends the DeletePrediction request. The method will close the
  1120  // http.Response Body if it receives an error.
  1121  func (client BaseClient) DeletePredictionSender(req *http.Request) (*http.Response, error) {
  1122  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1123  }
  1124  
  1125  // DeletePredictionResponder handles the response to the DeletePrediction request. The method always
  1126  // closes the http.Response Body.
  1127  func (client BaseClient) DeletePredictionResponder(resp *http.Response) (result autorest.Response, err error) {
  1128  	err = autorest.Respond(
  1129  		resp,
  1130  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
  1131  		autorest.ByClosing())
  1132  	result.Response = resp
  1133  	return
  1134  }
  1135  
  1136  // DeleteProject sends the delete project request.
  1137  // Parameters:
  1138  // projectID - the project id.
  1139  func (client BaseClient) DeleteProject(ctx context.Context, projectID uuid.UUID) (result autorest.Response, err error) {
  1140  	if tracing.IsEnabled() {
  1141  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteProject")
  1142  		defer func() {
  1143  			sc := -1
  1144  			if result.Response != nil {
  1145  				sc = result.Response.StatusCode
  1146  			}
  1147  			tracing.EndSpan(ctx, sc, err)
  1148  		}()
  1149  	}
  1150  	req, err := client.DeleteProjectPreparer(ctx, projectID)
  1151  	if err != nil {
  1152  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteProject", nil, "Failure preparing request")
  1153  		return
  1154  	}
  1155  
  1156  	resp, err := client.DeleteProjectSender(req)
  1157  	if err != nil {
  1158  		result.Response = resp
  1159  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteProject", resp, "Failure sending request")
  1160  		return
  1161  	}
  1162  
  1163  	result, err = client.DeleteProjectResponder(resp)
  1164  	if err != nil {
  1165  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteProject", resp, "Failure responding to request")
  1166  		return
  1167  	}
  1168  
  1169  	return
  1170  }
  1171  
  1172  // DeleteProjectPreparer prepares the DeleteProject request.
  1173  func (client BaseClient) DeleteProjectPreparer(ctx context.Context, projectID uuid.UUID) (*http.Request, error) {
  1174  	urlParameters := map[string]interface{}{
  1175  		"Endpoint": client.Endpoint,
  1176  	}
  1177  
  1178  	pathParameters := map[string]interface{}{
  1179  		"projectId": autorest.Encode("path", projectID),
  1180  	}
  1181  
  1182  	preparer := autorest.CreatePreparer(
  1183  		autorest.AsDelete(),
  1184  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1185  		autorest.WithPathParameters("/projects/{projectId}", pathParameters))
  1186  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1187  }
  1188  
  1189  // DeleteProjectSender sends the DeleteProject request. The method will close the
  1190  // http.Response Body if it receives an error.
  1191  func (client BaseClient) DeleteProjectSender(req *http.Request) (*http.Response, error) {
  1192  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1193  }
  1194  
  1195  // DeleteProjectResponder handles the response to the DeleteProject request. The method always
  1196  // closes the http.Response Body.
  1197  func (client BaseClient) DeleteProjectResponder(resp *http.Response) (result autorest.Response, err error) {
  1198  	err = autorest.Respond(
  1199  		resp,
  1200  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
  1201  		autorest.ByClosing())
  1202  	result.Response = resp
  1203  	return
  1204  }
  1205  
  1206  // DeleteTag sends the delete tag request.
  1207  // Parameters:
  1208  // projectID - the project id.
  1209  // tagID - id of the tag to be deleted.
  1210  func (client BaseClient) DeleteTag(ctx context.Context, projectID uuid.UUID, tagID uuid.UUID) (result autorest.Response, err error) {
  1211  	if tracing.IsEnabled() {
  1212  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteTag")
  1213  		defer func() {
  1214  			sc := -1
  1215  			if result.Response != nil {
  1216  				sc = result.Response.StatusCode
  1217  			}
  1218  			tracing.EndSpan(ctx, sc, err)
  1219  		}()
  1220  	}
  1221  	req, err := client.DeleteTagPreparer(ctx, projectID, tagID)
  1222  	if err != nil {
  1223  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteTag", nil, "Failure preparing request")
  1224  		return
  1225  	}
  1226  
  1227  	resp, err := client.DeleteTagSender(req)
  1228  	if err != nil {
  1229  		result.Response = resp
  1230  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteTag", resp, "Failure sending request")
  1231  		return
  1232  	}
  1233  
  1234  	result, err = client.DeleteTagResponder(resp)
  1235  	if err != nil {
  1236  		err = autorest.NewErrorWithError(err, "training.BaseClient", "DeleteTag", resp, "Failure responding to request")
  1237  		return
  1238  	}
  1239  
  1240  	return
  1241  }
  1242  
  1243  // DeleteTagPreparer prepares the DeleteTag request.
  1244  func (client BaseClient) DeleteTagPreparer(ctx context.Context, projectID uuid.UUID, tagID uuid.UUID) (*http.Request, error) {
  1245  	urlParameters := map[string]interface{}{
  1246  		"Endpoint": client.Endpoint,
  1247  	}
  1248  
  1249  	pathParameters := map[string]interface{}{
  1250  		"projectId": autorest.Encode("path", projectID),
  1251  		"tagId":     autorest.Encode("path", tagID),
  1252  	}
  1253  
  1254  	preparer := autorest.CreatePreparer(
  1255  		autorest.AsDelete(),
  1256  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1257  		autorest.WithPathParameters("/projects/{projectId}/tags/{tagId}", pathParameters))
  1258  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1259  }
  1260  
  1261  // DeleteTagSender sends the DeleteTag request. The method will close the
  1262  // http.Response Body if it receives an error.
  1263  func (client BaseClient) DeleteTagSender(req *http.Request) (*http.Response, error) {
  1264  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1265  }
  1266  
  1267  // DeleteTagResponder handles the response to the DeleteTag request. The method always
  1268  // closes the http.Response Body.
  1269  func (client BaseClient) DeleteTagResponder(resp *http.Response) (result autorest.Response, err error) {
  1270  	err = autorest.Respond(
  1271  		resp,
  1272  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
  1273  		autorest.ByClosing())
  1274  	result.Response = resp
  1275  	return
  1276  }
  1277  
  1278  // ExportIteration sends the export iteration request.
  1279  // Parameters:
  1280  // projectID - the project id.
  1281  // iterationID - the iteration id.
  1282  // platform - the target platform.
  1283  // flavor - the flavor of the target platform.
  1284  func (client BaseClient) ExportIteration(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, platform string, flavor string) (result Export, err error) {
  1285  	if tracing.IsEnabled() {
  1286  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ExportIteration")
  1287  		defer func() {
  1288  			sc := -1
  1289  			if result.Response.Response != nil {
  1290  				sc = result.Response.Response.StatusCode
  1291  			}
  1292  			tracing.EndSpan(ctx, sc, err)
  1293  		}()
  1294  	}
  1295  	req, err := client.ExportIterationPreparer(ctx, projectID, iterationID, platform, flavor)
  1296  	if err != nil {
  1297  		err = autorest.NewErrorWithError(err, "training.BaseClient", "ExportIteration", nil, "Failure preparing request")
  1298  		return
  1299  	}
  1300  
  1301  	resp, err := client.ExportIterationSender(req)
  1302  	if err != nil {
  1303  		result.Response = autorest.Response{Response: resp}
  1304  		err = autorest.NewErrorWithError(err, "training.BaseClient", "ExportIteration", resp, "Failure sending request")
  1305  		return
  1306  	}
  1307  
  1308  	result, err = client.ExportIterationResponder(resp)
  1309  	if err != nil {
  1310  		err = autorest.NewErrorWithError(err, "training.BaseClient", "ExportIteration", resp, "Failure responding to request")
  1311  		return
  1312  	}
  1313  
  1314  	return
  1315  }
  1316  
  1317  // ExportIterationPreparer prepares the ExportIteration request.
  1318  func (client BaseClient) ExportIterationPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, platform string, flavor string) (*http.Request, error) {
  1319  	urlParameters := map[string]interface{}{
  1320  		"Endpoint": client.Endpoint,
  1321  	}
  1322  
  1323  	pathParameters := map[string]interface{}{
  1324  		"iterationId": autorest.Encode("path", iterationID),
  1325  		"projectId":   autorest.Encode("path", projectID),
  1326  	}
  1327  
  1328  	queryParameters := map[string]interface{}{
  1329  		"platform": autorest.Encode("query", platform),
  1330  	}
  1331  	if len(string(flavor)) > 0 {
  1332  		queryParameters["flavor"] = autorest.Encode("query", flavor)
  1333  	}
  1334  
  1335  	preparer := autorest.CreatePreparer(
  1336  		autorest.AsPost(),
  1337  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1338  		autorest.WithPathParameters("/projects/{projectId}/iterations/{iterationId}/export", pathParameters),
  1339  		autorest.WithQueryParameters(queryParameters))
  1340  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1341  }
  1342  
  1343  // ExportIterationSender sends the ExportIteration request. The method will close the
  1344  // http.Response Body if it receives an error.
  1345  func (client BaseClient) ExportIterationSender(req *http.Request) (*http.Response, error) {
  1346  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1347  }
  1348  
  1349  // ExportIterationResponder handles the response to the ExportIteration request. The method always
  1350  // closes the http.Response Body.
  1351  func (client BaseClient) ExportIterationResponder(resp *http.Response) (result Export, err error) {
  1352  	err = autorest.Respond(
  1353  		resp,
  1354  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1355  		autorest.ByUnmarshallingJSON(&result),
  1356  		autorest.ByClosing())
  1357  	result.Response = autorest.Response{Response: resp}
  1358  	return
  1359  }
  1360  
  1361  // ExportProject sends the export project request.
  1362  // Parameters:
  1363  // projectID - the project id of the project to export.
  1364  func (client BaseClient) ExportProject(ctx context.Context, projectID uuid.UUID) (result ProjectExport, err error) {
  1365  	if tracing.IsEnabled() {
  1366  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ExportProject")
  1367  		defer func() {
  1368  			sc := -1
  1369  			if result.Response.Response != nil {
  1370  				sc = result.Response.Response.StatusCode
  1371  			}
  1372  			tracing.EndSpan(ctx, sc, err)
  1373  		}()
  1374  	}
  1375  	req, err := client.ExportProjectPreparer(ctx, projectID)
  1376  	if err != nil {
  1377  		err = autorest.NewErrorWithError(err, "training.BaseClient", "ExportProject", nil, "Failure preparing request")
  1378  		return
  1379  	}
  1380  
  1381  	resp, err := client.ExportProjectSender(req)
  1382  	if err != nil {
  1383  		result.Response = autorest.Response{Response: resp}
  1384  		err = autorest.NewErrorWithError(err, "training.BaseClient", "ExportProject", resp, "Failure sending request")
  1385  		return
  1386  	}
  1387  
  1388  	result, err = client.ExportProjectResponder(resp)
  1389  	if err != nil {
  1390  		err = autorest.NewErrorWithError(err, "training.BaseClient", "ExportProject", resp, "Failure responding to request")
  1391  		return
  1392  	}
  1393  
  1394  	return
  1395  }
  1396  
  1397  // ExportProjectPreparer prepares the ExportProject request.
  1398  func (client BaseClient) ExportProjectPreparer(ctx context.Context, projectID uuid.UUID) (*http.Request, error) {
  1399  	urlParameters := map[string]interface{}{
  1400  		"Endpoint": client.Endpoint,
  1401  	}
  1402  
  1403  	pathParameters := map[string]interface{}{
  1404  		"projectId": autorest.Encode("path", projectID),
  1405  	}
  1406  
  1407  	preparer := autorest.CreatePreparer(
  1408  		autorest.AsGet(),
  1409  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1410  		autorest.WithPathParameters("/projects/{projectId}/export", pathParameters))
  1411  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1412  }
  1413  
  1414  // ExportProjectSender sends the ExportProject request. The method will close the
  1415  // http.Response Body if it receives an error.
  1416  func (client BaseClient) ExportProjectSender(req *http.Request) (*http.Response, error) {
  1417  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1418  }
  1419  
  1420  // ExportProjectResponder handles the response to the ExportProject request. The method always
  1421  // closes the http.Response Body.
  1422  func (client BaseClient) ExportProjectResponder(resp *http.Response) (result ProjectExport, err error) {
  1423  	err = autorest.Respond(
  1424  		resp,
  1425  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1426  		autorest.ByUnmarshallingJSON(&result),
  1427  		autorest.ByClosing())
  1428  	result.Response = autorest.Response{Response: resp}
  1429  	return
  1430  }
  1431  
  1432  // GetArtifact sends the get artifact request.
  1433  // Parameters:
  1434  // projectID - the project id.
  1435  // pathParameter - the relative path for artifact.
  1436  func (client BaseClient) GetArtifact(ctx context.Context, projectID uuid.UUID, pathParameter string) (result ReadCloser, err error) {
  1437  	if tracing.IsEnabled() {
  1438  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetArtifact")
  1439  		defer func() {
  1440  			sc := -1
  1441  			if result.Response.Response != nil {
  1442  				sc = result.Response.Response.StatusCode
  1443  			}
  1444  			tracing.EndSpan(ctx, sc, err)
  1445  		}()
  1446  	}
  1447  	req, err := client.GetArtifactPreparer(ctx, projectID, pathParameter)
  1448  	if err != nil {
  1449  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetArtifact", nil, "Failure preparing request")
  1450  		return
  1451  	}
  1452  
  1453  	resp, err := client.GetArtifactSender(req)
  1454  	if err != nil {
  1455  		result.Response = autorest.Response{Response: resp}
  1456  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetArtifact", resp, "Failure sending request")
  1457  		return
  1458  	}
  1459  
  1460  	result, err = client.GetArtifactResponder(resp)
  1461  	if err != nil {
  1462  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetArtifact", resp, "Failure responding to request")
  1463  		return
  1464  	}
  1465  
  1466  	return
  1467  }
  1468  
  1469  // GetArtifactPreparer prepares the GetArtifact request.
  1470  func (client BaseClient) GetArtifactPreparer(ctx context.Context, projectID uuid.UUID, pathParameter string) (*http.Request, error) {
  1471  	urlParameters := map[string]interface{}{
  1472  		"Endpoint": client.Endpoint,
  1473  	}
  1474  
  1475  	pathParameters := map[string]interface{}{
  1476  		"projectId": autorest.Encode("path", projectID),
  1477  	}
  1478  
  1479  	queryParameters := map[string]interface{}{
  1480  		"path": autorest.Encode("query", pathParameter),
  1481  	}
  1482  
  1483  	preparer := autorest.CreatePreparer(
  1484  		autorest.AsGet(),
  1485  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1486  		autorest.WithPathParameters("/projects/{projectId}/artifacts", pathParameters),
  1487  		autorest.WithQueryParameters(queryParameters))
  1488  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1489  }
  1490  
  1491  // GetArtifactSender sends the GetArtifact request. The method will close the
  1492  // http.Response Body if it receives an error.
  1493  func (client BaseClient) GetArtifactSender(req *http.Request) (*http.Response, error) {
  1494  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1495  }
  1496  
  1497  // GetArtifactResponder handles the response to the GetArtifact request. The method always
  1498  // closes the http.Response Body.
  1499  func (client BaseClient) GetArtifactResponder(resp *http.Response) (result ReadCloser, err error) {
  1500  	result.Value = &resp.Body
  1501  	err = autorest.Respond(
  1502  		resp,
  1503  		azure.WithErrorUnlessStatusCode(http.StatusOK))
  1504  	result.Response = autorest.Response{Response: resp}
  1505  	return
  1506  }
  1507  
  1508  // GetDomain sends the get domain request.
  1509  // Parameters:
  1510  // domainID - the id of the domain to get information about.
  1511  func (client BaseClient) GetDomain(ctx context.Context, domainID uuid.UUID) (result Domain, err error) {
  1512  	if tracing.IsEnabled() {
  1513  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDomain")
  1514  		defer func() {
  1515  			sc := -1
  1516  			if result.Response.Response != nil {
  1517  				sc = result.Response.Response.StatusCode
  1518  			}
  1519  			tracing.EndSpan(ctx, sc, err)
  1520  		}()
  1521  	}
  1522  	req, err := client.GetDomainPreparer(ctx, domainID)
  1523  	if err != nil {
  1524  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetDomain", nil, "Failure preparing request")
  1525  		return
  1526  	}
  1527  
  1528  	resp, err := client.GetDomainSender(req)
  1529  	if err != nil {
  1530  		result.Response = autorest.Response{Response: resp}
  1531  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetDomain", resp, "Failure sending request")
  1532  		return
  1533  	}
  1534  
  1535  	result, err = client.GetDomainResponder(resp)
  1536  	if err != nil {
  1537  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetDomain", resp, "Failure responding to request")
  1538  		return
  1539  	}
  1540  
  1541  	return
  1542  }
  1543  
  1544  // GetDomainPreparer prepares the GetDomain request.
  1545  func (client BaseClient) GetDomainPreparer(ctx context.Context, domainID uuid.UUID) (*http.Request, error) {
  1546  	urlParameters := map[string]interface{}{
  1547  		"Endpoint": client.Endpoint,
  1548  	}
  1549  
  1550  	pathParameters := map[string]interface{}{
  1551  		"domainId": autorest.Encode("path", domainID),
  1552  	}
  1553  
  1554  	preparer := autorest.CreatePreparer(
  1555  		autorest.AsGet(),
  1556  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1557  		autorest.WithPathParameters("/domains/{domainId}", pathParameters))
  1558  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1559  }
  1560  
  1561  // GetDomainSender sends the GetDomain request. The method will close the
  1562  // http.Response Body if it receives an error.
  1563  func (client BaseClient) GetDomainSender(req *http.Request) (*http.Response, error) {
  1564  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1565  }
  1566  
  1567  // GetDomainResponder handles the response to the GetDomain request. The method always
  1568  // closes the http.Response Body.
  1569  func (client BaseClient) GetDomainResponder(resp *http.Response) (result Domain, err error) {
  1570  	err = autorest.Respond(
  1571  		resp,
  1572  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1573  		autorest.ByUnmarshallingJSON(&result),
  1574  		autorest.ByClosing())
  1575  	result.Response = autorest.Response{Response: resp}
  1576  	return
  1577  }
  1578  
  1579  // GetDomains sends the get domains request.
  1580  func (client BaseClient) GetDomains(ctx context.Context) (result ListDomain, err error) {
  1581  	if tracing.IsEnabled() {
  1582  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetDomains")
  1583  		defer func() {
  1584  			sc := -1
  1585  			if result.Response.Response != nil {
  1586  				sc = result.Response.Response.StatusCode
  1587  			}
  1588  			tracing.EndSpan(ctx, sc, err)
  1589  		}()
  1590  	}
  1591  	req, err := client.GetDomainsPreparer(ctx)
  1592  	if err != nil {
  1593  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetDomains", nil, "Failure preparing request")
  1594  		return
  1595  	}
  1596  
  1597  	resp, err := client.GetDomainsSender(req)
  1598  	if err != nil {
  1599  		result.Response = autorest.Response{Response: resp}
  1600  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetDomains", resp, "Failure sending request")
  1601  		return
  1602  	}
  1603  
  1604  	result, err = client.GetDomainsResponder(resp)
  1605  	if err != nil {
  1606  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetDomains", resp, "Failure responding to request")
  1607  		return
  1608  	}
  1609  
  1610  	return
  1611  }
  1612  
  1613  // GetDomainsPreparer prepares the GetDomains request.
  1614  func (client BaseClient) GetDomainsPreparer(ctx context.Context) (*http.Request, error) {
  1615  	urlParameters := map[string]interface{}{
  1616  		"Endpoint": client.Endpoint,
  1617  	}
  1618  
  1619  	preparer := autorest.CreatePreparer(
  1620  		autorest.AsGet(),
  1621  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1622  		autorest.WithPath("/domains"))
  1623  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1624  }
  1625  
  1626  // GetDomainsSender sends the GetDomains request. The method will close the
  1627  // http.Response Body if it receives an error.
  1628  func (client BaseClient) GetDomainsSender(req *http.Request) (*http.Response, error) {
  1629  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1630  }
  1631  
  1632  // GetDomainsResponder handles the response to the GetDomains request. The method always
  1633  // closes the http.Response Body.
  1634  func (client BaseClient) GetDomainsResponder(resp *http.Response) (result ListDomain, err error) {
  1635  	err = autorest.Respond(
  1636  		resp,
  1637  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1638  		autorest.ByUnmarshallingJSON(&result.Value),
  1639  		autorest.ByClosing())
  1640  	result.Response = autorest.Response{Response: resp}
  1641  	return
  1642  }
  1643  
  1644  // GetExports sends the get exports request.
  1645  // Parameters:
  1646  // projectID - the project id.
  1647  // iterationID - the iteration id.
  1648  func (client BaseClient) GetExports(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID) (result ListExport, err error) {
  1649  	if tracing.IsEnabled() {
  1650  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetExports")
  1651  		defer func() {
  1652  			sc := -1
  1653  			if result.Response.Response != nil {
  1654  				sc = result.Response.Response.StatusCode
  1655  			}
  1656  			tracing.EndSpan(ctx, sc, err)
  1657  		}()
  1658  	}
  1659  	req, err := client.GetExportsPreparer(ctx, projectID, iterationID)
  1660  	if err != nil {
  1661  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetExports", nil, "Failure preparing request")
  1662  		return
  1663  	}
  1664  
  1665  	resp, err := client.GetExportsSender(req)
  1666  	if err != nil {
  1667  		result.Response = autorest.Response{Response: resp}
  1668  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetExports", resp, "Failure sending request")
  1669  		return
  1670  	}
  1671  
  1672  	result, err = client.GetExportsResponder(resp)
  1673  	if err != nil {
  1674  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetExports", resp, "Failure responding to request")
  1675  		return
  1676  	}
  1677  
  1678  	return
  1679  }
  1680  
  1681  // GetExportsPreparer prepares the GetExports request.
  1682  func (client BaseClient) GetExportsPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID) (*http.Request, error) {
  1683  	urlParameters := map[string]interface{}{
  1684  		"Endpoint": client.Endpoint,
  1685  	}
  1686  
  1687  	pathParameters := map[string]interface{}{
  1688  		"iterationId": autorest.Encode("path", iterationID),
  1689  		"projectId":   autorest.Encode("path", projectID),
  1690  	}
  1691  
  1692  	preparer := autorest.CreatePreparer(
  1693  		autorest.AsGet(),
  1694  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1695  		autorest.WithPathParameters("/projects/{projectId}/iterations/{iterationId}/export", pathParameters))
  1696  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1697  }
  1698  
  1699  // GetExportsSender sends the GetExports request. The method will close the
  1700  // http.Response Body if it receives an error.
  1701  func (client BaseClient) GetExportsSender(req *http.Request) (*http.Response, error) {
  1702  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1703  }
  1704  
  1705  // GetExportsResponder handles the response to the GetExports request. The method always
  1706  // closes the http.Response Body.
  1707  func (client BaseClient) GetExportsResponder(resp *http.Response) (result ListExport, err error) {
  1708  	err = autorest.Respond(
  1709  		resp,
  1710  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1711  		autorest.ByUnmarshallingJSON(&result.Value),
  1712  		autorest.ByClosing())
  1713  	result.Response = autorest.Response{Response: resp}
  1714  	return
  1715  }
  1716  
  1717  // GetImageCount the filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and
  1718  // "Cat" tags, then only images tagged with Dog and/or Cat will be returned
  1719  // Parameters:
  1720  // projectID - the project id.
  1721  // iterationID - the iteration id. Defaults to workspace.
  1722  // taggingStatus - the tagging status filter. It can be 'All', 'Tagged', or 'Untagged'. Defaults to 'All'.
  1723  // filter - an expression to filter the images against image metadata. Only images where the expression
  1724  // evaluates to true are included in the response.
  1725  // The expression supports eq (Equal), ne (Not equal), and (Logical and), or (Logical or) operators.
  1726  // Here is an example, metadata=key1 eq 'value1' and key2 ne 'value2'.
  1727  // tagIds - a list of tags ids to filter the images to count. Defaults to all tags when null.
  1728  func (client BaseClient) GetImageCount(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID, taggingStatus string, filter string, tagIds []uuid.UUID) (result Int32, err error) {
  1729  	if tracing.IsEnabled() {
  1730  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetImageCount")
  1731  		defer func() {
  1732  			sc := -1
  1733  			if result.Response.Response != nil {
  1734  				sc = result.Response.Response.StatusCode
  1735  			}
  1736  			tracing.EndSpan(ctx, sc, err)
  1737  		}()
  1738  	}
  1739  	req, err := client.GetImageCountPreparer(ctx, projectID, iterationID, taggingStatus, filter, tagIds)
  1740  	if err != nil {
  1741  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImageCount", nil, "Failure preparing request")
  1742  		return
  1743  	}
  1744  
  1745  	resp, err := client.GetImageCountSender(req)
  1746  	if err != nil {
  1747  		result.Response = autorest.Response{Response: resp}
  1748  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImageCount", resp, "Failure sending request")
  1749  		return
  1750  	}
  1751  
  1752  	result, err = client.GetImageCountResponder(resp)
  1753  	if err != nil {
  1754  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImageCount", resp, "Failure responding to request")
  1755  		return
  1756  	}
  1757  
  1758  	return
  1759  }
  1760  
  1761  // GetImageCountPreparer prepares the GetImageCount request.
  1762  func (client BaseClient) GetImageCountPreparer(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID, taggingStatus string, filter string, tagIds []uuid.UUID) (*http.Request, error) {
  1763  	urlParameters := map[string]interface{}{
  1764  		"Endpoint": client.Endpoint,
  1765  	}
  1766  
  1767  	pathParameters := map[string]interface{}{
  1768  		"projectId": autorest.Encode("path", projectID),
  1769  	}
  1770  
  1771  	queryParameters := map[string]interface{}{}
  1772  	if iterationID != nil {
  1773  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  1774  	}
  1775  	if len(string(taggingStatus)) > 0 {
  1776  		queryParameters["taggingStatus"] = autorest.Encode("query", taggingStatus)
  1777  	}
  1778  	if len(filter) > 0 {
  1779  		queryParameters["$filter"] = autorest.Encode("query", filter)
  1780  	}
  1781  	if tagIds != nil && len(tagIds) > 0 {
  1782  		queryParameters["tagIds"] = autorest.Encode("query", tagIds, ",")
  1783  	}
  1784  
  1785  	preparer := autorest.CreatePreparer(
  1786  		autorest.AsGet(),
  1787  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1788  		autorest.WithPathParameters("/projects/{projectId}/images/count", pathParameters),
  1789  		autorest.WithQueryParameters(queryParameters))
  1790  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1791  }
  1792  
  1793  // GetImageCountSender sends the GetImageCount request. The method will close the
  1794  // http.Response Body if it receives an error.
  1795  func (client BaseClient) GetImageCountSender(req *http.Request) (*http.Response, error) {
  1796  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1797  }
  1798  
  1799  // GetImageCountResponder handles the response to the GetImageCount request. The method always
  1800  // closes the http.Response Body.
  1801  func (client BaseClient) GetImageCountResponder(resp *http.Response) (result Int32, err error) {
  1802  	err = autorest.Respond(
  1803  		resp,
  1804  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1805  		autorest.ByUnmarshallingJSON(&result.Value),
  1806  		autorest.ByClosing())
  1807  	result.Response = autorest.Response{Response: resp}
  1808  	return
  1809  }
  1810  
  1811  // GetImagePerformanceCount the filtering is on an and/or relationship. For example, if the provided tag ids are for
  1812  // the "Dog" and
  1813  // "Cat" tags, then only images tagged with Dog and/or Cat will be returned
  1814  // Parameters:
  1815  // projectID - the project id.
  1816  // iterationID - the iteration id. Defaults to workspace.
  1817  // tagIds - a list of tags ids to filter the images to count. Defaults to all tags when null.
  1818  func (client BaseClient) GetImagePerformanceCount(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, tagIds []uuid.UUID) (result Int32, err error) {
  1819  	if tracing.IsEnabled() {
  1820  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetImagePerformanceCount")
  1821  		defer func() {
  1822  			sc := -1
  1823  			if result.Response.Response != nil {
  1824  				sc = result.Response.Response.StatusCode
  1825  			}
  1826  			tracing.EndSpan(ctx, sc, err)
  1827  		}()
  1828  	}
  1829  	req, err := client.GetImagePerformanceCountPreparer(ctx, projectID, iterationID, tagIds)
  1830  	if err != nil {
  1831  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImagePerformanceCount", nil, "Failure preparing request")
  1832  		return
  1833  	}
  1834  
  1835  	resp, err := client.GetImagePerformanceCountSender(req)
  1836  	if err != nil {
  1837  		result.Response = autorest.Response{Response: resp}
  1838  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImagePerformanceCount", resp, "Failure sending request")
  1839  		return
  1840  	}
  1841  
  1842  	result, err = client.GetImagePerformanceCountResponder(resp)
  1843  	if err != nil {
  1844  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImagePerformanceCount", resp, "Failure responding to request")
  1845  		return
  1846  	}
  1847  
  1848  	return
  1849  }
  1850  
  1851  // GetImagePerformanceCountPreparer prepares the GetImagePerformanceCount request.
  1852  func (client BaseClient) GetImagePerformanceCountPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, tagIds []uuid.UUID) (*http.Request, error) {
  1853  	urlParameters := map[string]interface{}{
  1854  		"Endpoint": client.Endpoint,
  1855  	}
  1856  
  1857  	pathParameters := map[string]interface{}{
  1858  		"iterationId": autorest.Encode("path", iterationID),
  1859  		"projectId":   autorest.Encode("path", projectID),
  1860  	}
  1861  
  1862  	queryParameters := map[string]interface{}{}
  1863  	if tagIds != nil && len(tagIds) > 0 {
  1864  		queryParameters["tagIds"] = autorest.Encode("query", tagIds, ",")
  1865  	}
  1866  
  1867  	preparer := autorest.CreatePreparer(
  1868  		autorest.AsGet(),
  1869  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1870  		autorest.WithPathParameters("/projects/{projectId}/iterations/{iterationId}/performance/images/count", pathParameters),
  1871  		autorest.WithQueryParameters(queryParameters))
  1872  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1873  }
  1874  
  1875  // GetImagePerformanceCountSender sends the GetImagePerformanceCount request. The method will close the
  1876  // http.Response Body if it receives an error.
  1877  func (client BaseClient) GetImagePerformanceCountSender(req *http.Request) (*http.Response, error) {
  1878  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1879  }
  1880  
  1881  // GetImagePerformanceCountResponder handles the response to the GetImagePerformanceCount request. The method always
  1882  // closes the http.Response Body.
  1883  func (client BaseClient) GetImagePerformanceCountResponder(resp *http.Response) (result Int32, err error) {
  1884  	err = autorest.Respond(
  1885  		resp,
  1886  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1887  		autorest.ByUnmarshallingJSON(&result.Value),
  1888  		autorest.ByClosing())
  1889  	result.Response = autorest.Response{Response: resp}
  1890  	return
  1891  }
  1892  
  1893  // GetImagePerformances this API supports batching and range selection. By default it will only return first 50 images
  1894  // matching images.
  1895  // Use the {take} and {skip} parameters to control how many images to return in a given batch.
  1896  // The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and
  1897  // "Cat" tags, then only images tagged with Dog and/or Cat will be returned
  1898  // Parameters:
  1899  // projectID - the project id.
  1900  // iterationID - the iteration id. Defaults to workspace.
  1901  // tagIds - a list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20.
  1902  // orderBy - the ordering. Defaults to newest.
  1903  // take - maximum number of images to return. Defaults to 50, limited to 256.
  1904  // skip - number of images to skip before beginning the image batch. Defaults to 0.
  1905  func (client BaseClient) GetImagePerformances(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, tagIds []uuid.UUID, orderBy string, take *int32, skip *int32) (result ListImagePerformance, err error) {
  1906  	if tracing.IsEnabled() {
  1907  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetImagePerformances")
  1908  		defer func() {
  1909  			sc := -1
  1910  			if result.Response.Response != nil {
  1911  				sc = result.Response.Response.StatusCode
  1912  			}
  1913  			tracing.EndSpan(ctx, sc, err)
  1914  		}()
  1915  	}
  1916  	if err := validation.Validate([]validation.Validation{
  1917  		{TargetValue: tagIds,
  1918  			Constraints: []validation.Constraint{{Target: "tagIds", Name: validation.Null, Rule: false,
  1919  				Chain: []validation.Constraint{{Target: "tagIds", Name: validation.MaxItems, Rule: 20, Chain: nil},
  1920  					{Target: "tagIds", Name: validation.MinItems, Rule: 0, Chain: nil},
  1921  				}}}},
  1922  		{TargetValue: take,
  1923  			Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false,
  1924  				Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(256), Chain: nil},
  1925  					{Target: "take", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
  1926  				}}}}}); err != nil {
  1927  		return result, validation.NewError("training.BaseClient", "GetImagePerformances", err.Error())
  1928  	}
  1929  
  1930  	req, err := client.GetImagePerformancesPreparer(ctx, projectID, iterationID, tagIds, orderBy, take, skip)
  1931  	if err != nil {
  1932  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImagePerformances", nil, "Failure preparing request")
  1933  		return
  1934  	}
  1935  
  1936  	resp, err := client.GetImagePerformancesSender(req)
  1937  	if err != nil {
  1938  		result.Response = autorest.Response{Response: resp}
  1939  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImagePerformances", resp, "Failure sending request")
  1940  		return
  1941  	}
  1942  
  1943  	result, err = client.GetImagePerformancesResponder(resp)
  1944  	if err != nil {
  1945  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImagePerformances", resp, "Failure responding to request")
  1946  		return
  1947  	}
  1948  
  1949  	return
  1950  }
  1951  
  1952  // GetImagePerformancesPreparer prepares the GetImagePerformances request.
  1953  func (client BaseClient) GetImagePerformancesPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, tagIds []uuid.UUID, orderBy string, take *int32, skip *int32) (*http.Request, error) {
  1954  	urlParameters := map[string]interface{}{
  1955  		"Endpoint": client.Endpoint,
  1956  	}
  1957  
  1958  	pathParameters := map[string]interface{}{
  1959  		"iterationId": autorest.Encode("path", iterationID),
  1960  		"projectId":   autorest.Encode("path", projectID),
  1961  	}
  1962  
  1963  	queryParameters := map[string]interface{}{}
  1964  	if tagIds != nil && len(tagIds) > 0 {
  1965  		queryParameters["tagIds"] = autorest.Encode("query", tagIds, ",")
  1966  	}
  1967  	if len(string(orderBy)) > 0 {
  1968  		queryParameters["orderBy"] = autorest.Encode("query", orderBy)
  1969  	}
  1970  	if take != nil {
  1971  		queryParameters["take"] = autorest.Encode("query", *take)
  1972  	} else {
  1973  		queryParameters["take"] = autorest.Encode("query", 50)
  1974  	}
  1975  	if skip != nil {
  1976  		queryParameters["skip"] = autorest.Encode("query", *skip)
  1977  	} else {
  1978  		queryParameters["skip"] = autorest.Encode("query", 0)
  1979  	}
  1980  
  1981  	preparer := autorest.CreatePreparer(
  1982  		autorest.AsGet(),
  1983  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  1984  		autorest.WithPathParameters("/projects/{projectId}/iterations/{iterationId}/performance/images", pathParameters),
  1985  		autorest.WithQueryParameters(queryParameters))
  1986  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1987  }
  1988  
  1989  // GetImagePerformancesSender sends the GetImagePerformances request. The method will close the
  1990  // http.Response Body if it receives an error.
  1991  func (client BaseClient) GetImagePerformancesSender(req *http.Request) (*http.Response, error) {
  1992  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  1993  }
  1994  
  1995  // GetImagePerformancesResponder handles the response to the GetImagePerformances request. The method always
  1996  // closes the http.Response Body.
  1997  func (client BaseClient) GetImagePerformancesResponder(resp *http.Response) (result ListImagePerformance, err error) {
  1998  	err = autorest.Respond(
  1999  		resp,
  2000  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2001  		autorest.ByUnmarshallingJSON(&result.Value),
  2002  		autorest.ByClosing())
  2003  	result.Response = autorest.Response{Response: resp}
  2004  	return
  2005  }
  2006  
  2007  // GetImageRegionProposals this API will get region proposals for an image along with confidences for the region. It
  2008  // returns an empty array if no proposals are found.
  2009  // Parameters:
  2010  // projectID - the project id.
  2011  // imageID - the image id.
  2012  func (client BaseClient) GetImageRegionProposals(ctx context.Context, projectID uuid.UUID, imageID uuid.UUID) (result ImageRegionProposal, err error) {
  2013  	if tracing.IsEnabled() {
  2014  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetImageRegionProposals")
  2015  		defer func() {
  2016  			sc := -1
  2017  			if result.Response.Response != nil {
  2018  				sc = result.Response.Response.StatusCode
  2019  			}
  2020  			tracing.EndSpan(ctx, sc, err)
  2021  		}()
  2022  	}
  2023  	req, err := client.GetImageRegionProposalsPreparer(ctx, projectID, imageID)
  2024  	if err != nil {
  2025  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImageRegionProposals", nil, "Failure preparing request")
  2026  		return
  2027  	}
  2028  
  2029  	resp, err := client.GetImageRegionProposalsSender(req)
  2030  	if err != nil {
  2031  		result.Response = autorest.Response{Response: resp}
  2032  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImageRegionProposals", resp, "Failure sending request")
  2033  		return
  2034  	}
  2035  
  2036  	result, err = client.GetImageRegionProposalsResponder(resp)
  2037  	if err != nil {
  2038  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImageRegionProposals", resp, "Failure responding to request")
  2039  		return
  2040  	}
  2041  
  2042  	return
  2043  }
  2044  
  2045  // GetImageRegionProposalsPreparer prepares the GetImageRegionProposals request.
  2046  func (client BaseClient) GetImageRegionProposalsPreparer(ctx context.Context, projectID uuid.UUID, imageID uuid.UUID) (*http.Request, error) {
  2047  	urlParameters := map[string]interface{}{
  2048  		"Endpoint": client.Endpoint,
  2049  	}
  2050  
  2051  	pathParameters := map[string]interface{}{
  2052  		"imageId":   autorest.Encode("path", imageID),
  2053  		"projectId": autorest.Encode("path", projectID),
  2054  	}
  2055  
  2056  	preparer := autorest.CreatePreparer(
  2057  		autorest.AsPost(),
  2058  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2059  		autorest.WithPathParameters("/projects/{projectId}/images/{imageId}/regionproposals", pathParameters))
  2060  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2061  }
  2062  
  2063  // GetImageRegionProposalsSender sends the GetImageRegionProposals request. The method will close the
  2064  // http.Response Body if it receives an error.
  2065  func (client BaseClient) GetImageRegionProposalsSender(req *http.Request) (*http.Response, error) {
  2066  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2067  }
  2068  
  2069  // GetImageRegionProposalsResponder handles the response to the GetImageRegionProposals request. The method always
  2070  // closes the http.Response Body.
  2071  func (client BaseClient) GetImageRegionProposalsResponder(resp *http.Response) (result ImageRegionProposal, err error) {
  2072  	err = autorest.Respond(
  2073  		resp,
  2074  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2075  		autorest.ByUnmarshallingJSON(&result),
  2076  		autorest.ByClosing())
  2077  	result.Response = autorest.Response{Response: resp}
  2078  	return
  2079  }
  2080  
  2081  // GetImages this API supports batching and range selection. By default it will only return first 50 images matching
  2082  // images.
  2083  // Use the {take} and {skip} parameters to control how many images to return in a given batch.
  2084  // The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and
  2085  // "Cat" tags, then only images tagged with Dog and/or Cat will be returned
  2086  // Parameters:
  2087  // projectID - the project id.
  2088  // iterationID - the iteration id. Defaults to workspace.
  2089  // tagIds - a list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20.
  2090  // taggingStatus - the tagging status filter. It can be 'All', 'Tagged', or 'Untagged'. Defaults to 'All'.
  2091  // filter - an expression to filter the images against image metadata. Only images where the expression
  2092  // evaluates to true are included in the response.
  2093  // The expression supports eq (Equal), ne (Not equal), and (Logical and), or (Logical or) operators.
  2094  // Here is an example, metadata=key1 eq 'value1' and key2 ne 'value2'.
  2095  // orderBy - the ordering. Defaults to newest.
  2096  // take - maximum number of images to return. Defaults to 50, limited to 256.
  2097  // skip - number of images to skip before beginning the image batch. Defaults to 0.
  2098  func (client BaseClient) GetImages(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID, tagIds []uuid.UUID, taggingStatus string, filter string, orderBy string, take *int32, skip *int32) (result ListImage, err error) {
  2099  	if tracing.IsEnabled() {
  2100  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetImages")
  2101  		defer func() {
  2102  			sc := -1
  2103  			if result.Response.Response != nil {
  2104  				sc = result.Response.Response.StatusCode
  2105  			}
  2106  			tracing.EndSpan(ctx, sc, err)
  2107  		}()
  2108  	}
  2109  	if err := validation.Validate([]validation.Validation{
  2110  		{TargetValue: tagIds,
  2111  			Constraints: []validation.Constraint{{Target: "tagIds", Name: validation.Null, Rule: false,
  2112  				Chain: []validation.Constraint{{Target: "tagIds", Name: validation.MaxItems, Rule: 20, Chain: nil},
  2113  					{Target: "tagIds", Name: validation.MinItems, Rule: 0, Chain: nil},
  2114  				}}}},
  2115  		{TargetValue: take,
  2116  			Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false,
  2117  				Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(256), Chain: nil},
  2118  					{Target: "take", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
  2119  				}}}}}); err != nil {
  2120  		return result, validation.NewError("training.BaseClient", "GetImages", err.Error())
  2121  	}
  2122  
  2123  	req, err := client.GetImagesPreparer(ctx, projectID, iterationID, tagIds, taggingStatus, filter, orderBy, take, skip)
  2124  	if err != nil {
  2125  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImages", nil, "Failure preparing request")
  2126  		return
  2127  	}
  2128  
  2129  	resp, err := client.GetImagesSender(req)
  2130  	if err != nil {
  2131  		result.Response = autorest.Response{Response: resp}
  2132  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImages", resp, "Failure sending request")
  2133  		return
  2134  	}
  2135  
  2136  	result, err = client.GetImagesResponder(resp)
  2137  	if err != nil {
  2138  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImages", resp, "Failure responding to request")
  2139  		return
  2140  	}
  2141  
  2142  	return
  2143  }
  2144  
  2145  // GetImagesPreparer prepares the GetImages request.
  2146  func (client BaseClient) GetImagesPreparer(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID, tagIds []uuid.UUID, taggingStatus string, filter string, orderBy string, take *int32, skip *int32) (*http.Request, error) {
  2147  	urlParameters := map[string]interface{}{
  2148  		"Endpoint": client.Endpoint,
  2149  	}
  2150  
  2151  	pathParameters := map[string]interface{}{
  2152  		"projectId": autorest.Encode("path", projectID),
  2153  	}
  2154  
  2155  	queryParameters := map[string]interface{}{}
  2156  	if iterationID != nil {
  2157  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  2158  	}
  2159  	if tagIds != nil && len(tagIds) > 0 {
  2160  		queryParameters["tagIds"] = autorest.Encode("query", tagIds, ",")
  2161  	}
  2162  	if len(string(taggingStatus)) > 0 {
  2163  		queryParameters["taggingStatus"] = autorest.Encode("query", taggingStatus)
  2164  	}
  2165  	if len(filter) > 0 {
  2166  		queryParameters["$filter"] = autorest.Encode("query", filter)
  2167  	}
  2168  	if len(string(orderBy)) > 0 {
  2169  		queryParameters["orderBy"] = autorest.Encode("query", orderBy)
  2170  	}
  2171  	if take != nil {
  2172  		queryParameters["take"] = autorest.Encode("query", *take)
  2173  	} else {
  2174  		queryParameters["take"] = autorest.Encode("query", 50)
  2175  	}
  2176  	if skip != nil {
  2177  		queryParameters["skip"] = autorest.Encode("query", *skip)
  2178  	} else {
  2179  		queryParameters["skip"] = autorest.Encode("query", 0)
  2180  	}
  2181  
  2182  	preparer := autorest.CreatePreparer(
  2183  		autorest.AsGet(),
  2184  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2185  		autorest.WithPathParameters("/projects/{projectId}/images", pathParameters),
  2186  		autorest.WithQueryParameters(queryParameters))
  2187  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2188  }
  2189  
  2190  // GetImagesSender sends the GetImages request. The method will close the
  2191  // http.Response Body if it receives an error.
  2192  func (client BaseClient) GetImagesSender(req *http.Request) (*http.Response, error) {
  2193  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2194  }
  2195  
  2196  // GetImagesResponder handles the response to the GetImages request. The method always
  2197  // closes the http.Response Body.
  2198  func (client BaseClient) GetImagesResponder(resp *http.Response) (result ListImage, err error) {
  2199  	err = autorest.Respond(
  2200  		resp,
  2201  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2202  		autorest.ByUnmarshallingJSON(&result.Value),
  2203  		autorest.ByClosing())
  2204  	result.Response = autorest.Response{Response: resp}
  2205  	return
  2206  }
  2207  
  2208  // GetImagesByIds this API will return a set of Images for the specified tags and optionally iteration. If no iteration
  2209  // is specified the
  2210  // current workspace is used.
  2211  // Parameters:
  2212  // projectID - the project id.
  2213  // imageIds - the list of image ids to retrieve. Limited to 256.
  2214  // iterationID - the iteration id. Defaults to workspace.
  2215  func (client BaseClient) GetImagesByIds(ctx context.Context, projectID uuid.UUID, imageIds []uuid.UUID, iterationID *uuid.UUID) (result ListImage, err error) {
  2216  	if tracing.IsEnabled() {
  2217  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetImagesByIds")
  2218  		defer func() {
  2219  			sc := -1
  2220  			if result.Response.Response != nil {
  2221  				sc = result.Response.Response.StatusCode
  2222  			}
  2223  			tracing.EndSpan(ctx, sc, err)
  2224  		}()
  2225  	}
  2226  	if err := validation.Validate([]validation.Validation{
  2227  		{TargetValue: imageIds,
  2228  			Constraints: []validation.Constraint{{Target: "imageIds", Name: validation.Null, Rule: false,
  2229  				Chain: []validation.Constraint{{Target: "imageIds", Name: validation.MaxItems, Rule: 256, Chain: nil},
  2230  					{Target: "imageIds", Name: validation.MinItems, Rule: 0, Chain: nil},
  2231  				}}}}}); err != nil {
  2232  		return result, validation.NewError("training.BaseClient", "GetImagesByIds", err.Error())
  2233  	}
  2234  
  2235  	req, err := client.GetImagesByIdsPreparer(ctx, projectID, imageIds, iterationID)
  2236  	if err != nil {
  2237  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImagesByIds", nil, "Failure preparing request")
  2238  		return
  2239  	}
  2240  
  2241  	resp, err := client.GetImagesByIdsSender(req)
  2242  	if err != nil {
  2243  		result.Response = autorest.Response{Response: resp}
  2244  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImagesByIds", resp, "Failure sending request")
  2245  		return
  2246  	}
  2247  
  2248  	result, err = client.GetImagesByIdsResponder(resp)
  2249  	if err != nil {
  2250  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetImagesByIds", resp, "Failure responding to request")
  2251  		return
  2252  	}
  2253  
  2254  	return
  2255  }
  2256  
  2257  // GetImagesByIdsPreparer prepares the GetImagesByIds request.
  2258  func (client BaseClient) GetImagesByIdsPreparer(ctx context.Context, projectID uuid.UUID, imageIds []uuid.UUID, iterationID *uuid.UUID) (*http.Request, error) {
  2259  	urlParameters := map[string]interface{}{
  2260  		"Endpoint": client.Endpoint,
  2261  	}
  2262  
  2263  	pathParameters := map[string]interface{}{
  2264  		"projectId": autorest.Encode("path", projectID),
  2265  	}
  2266  
  2267  	queryParameters := map[string]interface{}{}
  2268  	if imageIds != nil && len(imageIds) > 0 {
  2269  		queryParameters["imageIds"] = autorest.Encode("query", imageIds, ",")
  2270  	}
  2271  	if iterationID != nil {
  2272  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  2273  	}
  2274  
  2275  	preparer := autorest.CreatePreparer(
  2276  		autorest.AsGet(),
  2277  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2278  		autorest.WithPathParameters("/projects/{projectId}/images/id", pathParameters),
  2279  		autorest.WithQueryParameters(queryParameters))
  2280  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2281  }
  2282  
  2283  // GetImagesByIdsSender sends the GetImagesByIds request. The method will close the
  2284  // http.Response Body if it receives an error.
  2285  func (client BaseClient) GetImagesByIdsSender(req *http.Request) (*http.Response, error) {
  2286  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2287  }
  2288  
  2289  // GetImagesByIdsResponder handles the response to the GetImagesByIds request. The method always
  2290  // closes the http.Response Body.
  2291  func (client BaseClient) GetImagesByIdsResponder(resp *http.Response) (result ListImage, err error) {
  2292  	err = autorest.Respond(
  2293  		resp,
  2294  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2295  		autorest.ByUnmarshallingJSON(&result.Value),
  2296  		autorest.ByClosing())
  2297  	result.Response = autorest.Response{Response: resp}
  2298  	return
  2299  }
  2300  
  2301  // GetIteration sends the get iteration request.
  2302  // Parameters:
  2303  // projectID - the id of the project the iteration belongs to.
  2304  // iterationID - the id of the iteration to get.
  2305  func (client BaseClient) GetIteration(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID) (result Iteration, err error) {
  2306  	if tracing.IsEnabled() {
  2307  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetIteration")
  2308  		defer func() {
  2309  			sc := -1
  2310  			if result.Response.Response != nil {
  2311  				sc = result.Response.Response.StatusCode
  2312  			}
  2313  			tracing.EndSpan(ctx, sc, err)
  2314  		}()
  2315  	}
  2316  	req, err := client.GetIterationPreparer(ctx, projectID, iterationID)
  2317  	if err != nil {
  2318  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetIteration", nil, "Failure preparing request")
  2319  		return
  2320  	}
  2321  
  2322  	resp, err := client.GetIterationSender(req)
  2323  	if err != nil {
  2324  		result.Response = autorest.Response{Response: resp}
  2325  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetIteration", resp, "Failure sending request")
  2326  		return
  2327  	}
  2328  
  2329  	result, err = client.GetIterationResponder(resp)
  2330  	if err != nil {
  2331  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetIteration", resp, "Failure responding to request")
  2332  		return
  2333  	}
  2334  
  2335  	return
  2336  }
  2337  
  2338  // GetIterationPreparer prepares the GetIteration request.
  2339  func (client BaseClient) GetIterationPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID) (*http.Request, error) {
  2340  	urlParameters := map[string]interface{}{
  2341  		"Endpoint": client.Endpoint,
  2342  	}
  2343  
  2344  	pathParameters := map[string]interface{}{
  2345  		"iterationId": autorest.Encode("path", iterationID),
  2346  		"projectId":   autorest.Encode("path", projectID),
  2347  	}
  2348  
  2349  	preparer := autorest.CreatePreparer(
  2350  		autorest.AsGet(),
  2351  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2352  		autorest.WithPathParameters("/projects/{projectId}/iterations/{iterationId}", pathParameters))
  2353  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2354  }
  2355  
  2356  // GetIterationSender sends the GetIteration request. The method will close the
  2357  // http.Response Body if it receives an error.
  2358  func (client BaseClient) GetIterationSender(req *http.Request) (*http.Response, error) {
  2359  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2360  }
  2361  
  2362  // GetIterationResponder handles the response to the GetIteration request. The method always
  2363  // closes the http.Response Body.
  2364  func (client BaseClient) GetIterationResponder(resp *http.Response) (result Iteration, err error) {
  2365  	err = autorest.Respond(
  2366  		resp,
  2367  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2368  		autorest.ByUnmarshallingJSON(&result),
  2369  		autorest.ByClosing())
  2370  	result.Response = autorest.Response{Response: resp}
  2371  	return
  2372  }
  2373  
  2374  // GetIterationPerformance sends the get iteration performance request.
  2375  // Parameters:
  2376  // projectID - the id of the project the iteration belongs to.
  2377  // iterationID - the id of the iteration to get.
  2378  // threshold - the threshold used to determine true predictions.
  2379  // overlapThreshold - if applicable, the bounding box overlap threshold used to determine true predictions.
  2380  func (client BaseClient) GetIterationPerformance(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, threshold *float64, overlapThreshold *float64) (result IterationPerformance, err error) {
  2381  	if tracing.IsEnabled() {
  2382  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetIterationPerformance")
  2383  		defer func() {
  2384  			sc := -1
  2385  			if result.Response.Response != nil {
  2386  				sc = result.Response.Response.StatusCode
  2387  			}
  2388  			tracing.EndSpan(ctx, sc, err)
  2389  		}()
  2390  	}
  2391  	req, err := client.GetIterationPerformancePreparer(ctx, projectID, iterationID, threshold, overlapThreshold)
  2392  	if err != nil {
  2393  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetIterationPerformance", nil, "Failure preparing request")
  2394  		return
  2395  	}
  2396  
  2397  	resp, err := client.GetIterationPerformanceSender(req)
  2398  	if err != nil {
  2399  		result.Response = autorest.Response{Response: resp}
  2400  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetIterationPerformance", resp, "Failure sending request")
  2401  		return
  2402  	}
  2403  
  2404  	result, err = client.GetIterationPerformanceResponder(resp)
  2405  	if err != nil {
  2406  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetIterationPerformance", resp, "Failure responding to request")
  2407  		return
  2408  	}
  2409  
  2410  	return
  2411  }
  2412  
  2413  // GetIterationPerformancePreparer prepares the GetIterationPerformance request.
  2414  func (client BaseClient) GetIterationPerformancePreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, threshold *float64, overlapThreshold *float64) (*http.Request, error) {
  2415  	urlParameters := map[string]interface{}{
  2416  		"Endpoint": client.Endpoint,
  2417  	}
  2418  
  2419  	pathParameters := map[string]interface{}{
  2420  		"iterationId": autorest.Encode("path", iterationID),
  2421  		"projectId":   autorest.Encode("path", projectID),
  2422  	}
  2423  
  2424  	queryParameters := map[string]interface{}{}
  2425  	if threshold != nil {
  2426  		queryParameters["threshold"] = autorest.Encode("query", *threshold)
  2427  	}
  2428  	if overlapThreshold != nil {
  2429  		queryParameters["overlapThreshold"] = autorest.Encode("query", *overlapThreshold)
  2430  	}
  2431  
  2432  	preparer := autorest.CreatePreparer(
  2433  		autorest.AsGet(),
  2434  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2435  		autorest.WithPathParameters("/projects/{projectId}/iterations/{iterationId}/performance", pathParameters),
  2436  		autorest.WithQueryParameters(queryParameters))
  2437  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2438  }
  2439  
  2440  // GetIterationPerformanceSender sends the GetIterationPerformance request. The method will close the
  2441  // http.Response Body if it receives an error.
  2442  func (client BaseClient) GetIterationPerformanceSender(req *http.Request) (*http.Response, error) {
  2443  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2444  }
  2445  
  2446  // GetIterationPerformanceResponder handles the response to the GetIterationPerformance request. The method always
  2447  // closes the http.Response Body.
  2448  func (client BaseClient) GetIterationPerformanceResponder(resp *http.Response) (result IterationPerformance, err error) {
  2449  	err = autorest.Respond(
  2450  		resp,
  2451  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2452  		autorest.ByUnmarshallingJSON(&result),
  2453  		autorest.ByClosing())
  2454  	result.Response = autorest.Response{Response: resp}
  2455  	return
  2456  }
  2457  
  2458  // GetIterations sends the get iterations request.
  2459  // Parameters:
  2460  // projectID - the project id.
  2461  func (client BaseClient) GetIterations(ctx context.Context, projectID uuid.UUID) (result ListIteration, err error) {
  2462  	if tracing.IsEnabled() {
  2463  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetIterations")
  2464  		defer func() {
  2465  			sc := -1
  2466  			if result.Response.Response != nil {
  2467  				sc = result.Response.Response.StatusCode
  2468  			}
  2469  			tracing.EndSpan(ctx, sc, err)
  2470  		}()
  2471  	}
  2472  	req, err := client.GetIterationsPreparer(ctx, projectID)
  2473  	if err != nil {
  2474  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetIterations", nil, "Failure preparing request")
  2475  		return
  2476  	}
  2477  
  2478  	resp, err := client.GetIterationsSender(req)
  2479  	if err != nil {
  2480  		result.Response = autorest.Response{Response: resp}
  2481  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetIterations", resp, "Failure sending request")
  2482  		return
  2483  	}
  2484  
  2485  	result, err = client.GetIterationsResponder(resp)
  2486  	if err != nil {
  2487  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetIterations", resp, "Failure responding to request")
  2488  		return
  2489  	}
  2490  
  2491  	return
  2492  }
  2493  
  2494  // GetIterationsPreparer prepares the GetIterations request.
  2495  func (client BaseClient) GetIterationsPreparer(ctx context.Context, projectID uuid.UUID) (*http.Request, error) {
  2496  	urlParameters := map[string]interface{}{
  2497  		"Endpoint": client.Endpoint,
  2498  	}
  2499  
  2500  	pathParameters := map[string]interface{}{
  2501  		"projectId": autorest.Encode("path", projectID),
  2502  	}
  2503  
  2504  	preparer := autorest.CreatePreparer(
  2505  		autorest.AsGet(),
  2506  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2507  		autorest.WithPathParameters("/projects/{projectId}/iterations", pathParameters))
  2508  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2509  }
  2510  
  2511  // GetIterationsSender sends the GetIterations request. The method will close the
  2512  // http.Response Body if it receives an error.
  2513  func (client BaseClient) GetIterationsSender(req *http.Request) (*http.Response, error) {
  2514  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2515  }
  2516  
  2517  // GetIterationsResponder handles the response to the GetIterations request. The method always
  2518  // closes the http.Response Body.
  2519  func (client BaseClient) GetIterationsResponder(resp *http.Response) (result ListIteration, err error) {
  2520  	err = autorest.Respond(
  2521  		resp,
  2522  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2523  		autorest.ByUnmarshallingJSON(&result.Value),
  2524  		autorest.ByClosing())
  2525  	result.Response = autorest.Response{Response: resp}
  2526  	return
  2527  }
  2528  
  2529  // GetProject sends the get project request.
  2530  // Parameters:
  2531  // projectID - the id of the project to get.
  2532  func (client BaseClient) GetProject(ctx context.Context, projectID uuid.UUID) (result Project, err error) {
  2533  	if tracing.IsEnabled() {
  2534  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetProject")
  2535  		defer func() {
  2536  			sc := -1
  2537  			if result.Response.Response != nil {
  2538  				sc = result.Response.Response.StatusCode
  2539  			}
  2540  			tracing.EndSpan(ctx, sc, err)
  2541  		}()
  2542  	}
  2543  	req, err := client.GetProjectPreparer(ctx, projectID)
  2544  	if err != nil {
  2545  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetProject", nil, "Failure preparing request")
  2546  		return
  2547  	}
  2548  
  2549  	resp, err := client.GetProjectSender(req)
  2550  	if err != nil {
  2551  		result.Response = autorest.Response{Response: resp}
  2552  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetProject", resp, "Failure sending request")
  2553  		return
  2554  	}
  2555  
  2556  	result, err = client.GetProjectResponder(resp)
  2557  	if err != nil {
  2558  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetProject", resp, "Failure responding to request")
  2559  		return
  2560  	}
  2561  
  2562  	return
  2563  }
  2564  
  2565  // GetProjectPreparer prepares the GetProject request.
  2566  func (client BaseClient) GetProjectPreparer(ctx context.Context, projectID uuid.UUID) (*http.Request, error) {
  2567  	urlParameters := map[string]interface{}{
  2568  		"Endpoint": client.Endpoint,
  2569  	}
  2570  
  2571  	pathParameters := map[string]interface{}{
  2572  		"projectId": autorest.Encode("path", projectID),
  2573  	}
  2574  
  2575  	preparer := autorest.CreatePreparer(
  2576  		autorest.AsGet(),
  2577  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2578  		autorest.WithPathParameters("/projects/{projectId}", pathParameters))
  2579  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2580  }
  2581  
  2582  // GetProjectSender sends the GetProject request. The method will close the
  2583  // http.Response Body if it receives an error.
  2584  func (client BaseClient) GetProjectSender(req *http.Request) (*http.Response, error) {
  2585  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2586  }
  2587  
  2588  // GetProjectResponder handles the response to the GetProject request. The method always
  2589  // closes the http.Response Body.
  2590  func (client BaseClient) GetProjectResponder(resp *http.Response) (result Project, err error) {
  2591  	err = autorest.Respond(
  2592  		resp,
  2593  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2594  		autorest.ByUnmarshallingJSON(&result),
  2595  		autorest.ByClosing())
  2596  	result.Response = autorest.Response{Response: resp}
  2597  	return
  2598  }
  2599  
  2600  // GetProjects sends the get projects request.
  2601  func (client BaseClient) GetProjects(ctx context.Context) (result ListProject, err error) {
  2602  	if tracing.IsEnabled() {
  2603  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetProjects")
  2604  		defer func() {
  2605  			sc := -1
  2606  			if result.Response.Response != nil {
  2607  				sc = result.Response.Response.StatusCode
  2608  			}
  2609  			tracing.EndSpan(ctx, sc, err)
  2610  		}()
  2611  	}
  2612  	req, err := client.GetProjectsPreparer(ctx)
  2613  	if err != nil {
  2614  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetProjects", nil, "Failure preparing request")
  2615  		return
  2616  	}
  2617  
  2618  	resp, err := client.GetProjectsSender(req)
  2619  	if err != nil {
  2620  		result.Response = autorest.Response{Response: resp}
  2621  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetProjects", resp, "Failure sending request")
  2622  		return
  2623  	}
  2624  
  2625  	result, err = client.GetProjectsResponder(resp)
  2626  	if err != nil {
  2627  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetProjects", resp, "Failure responding to request")
  2628  		return
  2629  	}
  2630  
  2631  	return
  2632  }
  2633  
  2634  // GetProjectsPreparer prepares the GetProjects request.
  2635  func (client BaseClient) GetProjectsPreparer(ctx context.Context) (*http.Request, error) {
  2636  	urlParameters := map[string]interface{}{
  2637  		"Endpoint": client.Endpoint,
  2638  	}
  2639  
  2640  	preparer := autorest.CreatePreparer(
  2641  		autorest.AsGet(),
  2642  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2643  		autorest.WithPath("/projects"))
  2644  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2645  }
  2646  
  2647  // GetProjectsSender sends the GetProjects request. The method will close the
  2648  // http.Response Body if it receives an error.
  2649  func (client BaseClient) GetProjectsSender(req *http.Request) (*http.Response, error) {
  2650  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2651  }
  2652  
  2653  // GetProjectsResponder handles the response to the GetProjects request. The method always
  2654  // closes the http.Response Body.
  2655  func (client BaseClient) GetProjectsResponder(resp *http.Response) (result ListProject, err error) {
  2656  	err = autorest.Respond(
  2657  		resp,
  2658  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2659  		autorest.ByUnmarshallingJSON(&result.Value),
  2660  		autorest.ByClosing())
  2661  	result.Response = autorest.Response{Response: resp}
  2662  	return
  2663  }
  2664  
  2665  // GetTag sends the get tag request.
  2666  // Parameters:
  2667  // projectID - the project this tag belongs to.
  2668  // tagID - the tag id.
  2669  // iterationID - the iteration to retrieve this tag from. Optional, defaults to current training set.
  2670  func (client BaseClient) GetTag(ctx context.Context, projectID uuid.UUID, tagID uuid.UUID, iterationID *uuid.UUID) (result Tag, err error) {
  2671  	if tracing.IsEnabled() {
  2672  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetTag")
  2673  		defer func() {
  2674  			sc := -1
  2675  			if result.Response.Response != nil {
  2676  				sc = result.Response.Response.StatusCode
  2677  			}
  2678  			tracing.EndSpan(ctx, sc, err)
  2679  		}()
  2680  	}
  2681  	req, err := client.GetTagPreparer(ctx, projectID, tagID, iterationID)
  2682  	if err != nil {
  2683  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTag", nil, "Failure preparing request")
  2684  		return
  2685  	}
  2686  
  2687  	resp, err := client.GetTagSender(req)
  2688  	if err != nil {
  2689  		result.Response = autorest.Response{Response: resp}
  2690  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTag", resp, "Failure sending request")
  2691  		return
  2692  	}
  2693  
  2694  	result, err = client.GetTagResponder(resp)
  2695  	if err != nil {
  2696  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTag", resp, "Failure responding to request")
  2697  		return
  2698  	}
  2699  
  2700  	return
  2701  }
  2702  
  2703  // GetTagPreparer prepares the GetTag request.
  2704  func (client BaseClient) GetTagPreparer(ctx context.Context, projectID uuid.UUID, tagID uuid.UUID, iterationID *uuid.UUID) (*http.Request, error) {
  2705  	urlParameters := map[string]interface{}{
  2706  		"Endpoint": client.Endpoint,
  2707  	}
  2708  
  2709  	pathParameters := map[string]interface{}{
  2710  		"projectId": autorest.Encode("path", projectID),
  2711  		"tagId":     autorest.Encode("path", tagID),
  2712  	}
  2713  
  2714  	queryParameters := map[string]interface{}{}
  2715  	if iterationID != nil {
  2716  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  2717  	}
  2718  
  2719  	preparer := autorest.CreatePreparer(
  2720  		autorest.AsGet(),
  2721  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2722  		autorest.WithPathParameters("/projects/{projectId}/tags/{tagId}", pathParameters),
  2723  		autorest.WithQueryParameters(queryParameters))
  2724  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2725  }
  2726  
  2727  // GetTagSender sends the GetTag request. The method will close the
  2728  // http.Response Body if it receives an error.
  2729  func (client BaseClient) GetTagSender(req *http.Request) (*http.Response, error) {
  2730  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2731  }
  2732  
  2733  // GetTagResponder handles the response to the GetTag request. The method always
  2734  // closes the http.Response Body.
  2735  func (client BaseClient) GetTagResponder(resp *http.Response) (result Tag, err error) {
  2736  	err = autorest.Respond(
  2737  		resp,
  2738  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2739  		autorest.ByUnmarshallingJSON(&result),
  2740  		autorest.ByClosing())
  2741  	result.Response = autorest.Response{Response: resp}
  2742  	return
  2743  }
  2744  
  2745  // GetTaggedImageCount the filtering is on an and/or relationship. For example, if the provided tag ids are for the
  2746  // "Dog" and
  2747  // "Cat" tags, then only images tagged with Dog and/or Cat will be returned
  2748  // Parameters:
  2749  // projectID - the project id.
  2750  // iterationID - the iteration id. Defaults to workspace.
  2751  // tagIds - a list of tags ids to filter the images to count. Defaults to all tags when null.
  2752  func (client BaseClient) GetTaggedImageCount(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID, tagIds []uuid.UUID) (result Int32, err error) {
  2753  	if tracing.IsEnabled() {
  2754  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetTaggedImageCount")
  2755  		defer func() {
  2756  			sc := -1
  2757  			if result.Response.Response != nil {
  2758  				sc = result.Response.Response.StatusCode
  2759  			}
  2760  			tracing.EndSpan(ctx, sc, err)
  2761  		}()
  2762  	}
  2763  	req, err := client.GetTaggedImageCountPreparer(ctx, projectID, iterationID, tagIds)
  2764  	if err != nil {
  2765  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTaggedImageCount", nil, "Failure preparing request")
  2766  		return
  2767  	}
  2768  
  2769  	resp, err := client.GetTaggedImageCountSender(req)
  2770  	if err != nil {
  2771  		result.Response = autorest.Response{Response: resp}
  2772  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTaggedImageCount", resp, "Failure sending request")
  2773  		return
  2774  	}
  2775  
  2776  	result, err = client.GetTaggedImageCountResponder(resp)
  2777  	if err != nil {
  2778  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTaggedImageCount", resp, "Failure responding to request")
  2779  		return
  2780  	}
  2781  
  2782  	return
  2783  }
  2784  
  2785  // GetTaggedImageCountPreparer prepares the GetTaggedImageCount request.
  2786  func (client BaseClient) GetTaggedImageCountPreparer(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID, tagIds []uuid.UUID) (*http.Request, error) {
  2787  	urlParameters := map[string]interface{}{
  2788  		"Endpoint": client.Endpoint,
  2789  	}
  2790  
  2791  	pathParameters := map[string]interface{}{
  2792  		"projectId": autorest.Encode("path", projectID),
  2793  	}
  2794  
  2795  	queryParameters := map[string]interface{}{}
  2796  	if iterationID != nil {
  2797  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  2798  	}
  2799  	if tagIds != nil && len(tagIds) > 0 {
  2800  		queryParameters["tagIds"] = autorest.Encode("query", tagIds, ",")
  2801  	}
  2802  
  2803  	preparer := autorest.CreatePreparer(
  2804  		autorest.AsGet(),
  2805  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2806  		autorest.WithPathParameters("/projects/{projectId}/images/tagged/count", pathParameters),
  2807  		autorest.WithQueryParameters(queryParameters))
  2808  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2809  }
  2810  
  2811  // GetTaggedImageCountSender sends the GetTaggedImageCount request. The method will close the
  2812  // http.Response Body if it receives an error.
  2813  func (client BaseClient) GetTaggedImageCountSender(req *http.Request) (*http.Response, error) {
  2814  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2815  }
  2816  
  2817  // GetTaggedImageCountResponder handles the response to the GetTaggedImageCount request. The method always
  2818  // closes the http.Response Body.
  2819  func (client BaseClient) GetTaggedImageCountResponder(resp *http.Response) (result Int32, err error) {
  2820  	err = autorest.Respond(
  2821  		resp,
  2822  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2823  		autorest.ByUnmarshallingJSON(&result.Value),
  2824  		autorest.ByClosing())
  2825  	result.Response = autorest.Response{Response: resp}
  2826  	return
  2827  }
  2828  
  2829  // GetTaggedImages this API supports batching and range selection. By default it will only return first 50 images
  2830  // matching images.
  2831  // Use the {take} and {skip} parameters to control how many images to return in a given batch.
  2832  // The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and
  2833  // "Cat" tags, then only images tagged with Dog and/or Cat will be returned
  2834  // Parameters:
  2835  // projectID - the project id.
  2836  // iterationID - the iteration id. Defaults to workspace.
  2837  // tagIds - a list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20.
  2838  // orderBy - the ordering. Defaults to newest.
  2839  // take - maximum number of images to return. Defaults to 50, limited to 256.
  2840  // skip - number of images to skip before beginning the image batch. Defaults to 0.
  2841  func (client BaseClient) GetTaggedImages(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID, tagIds []uuid.UUID, orderBy string, take *int32, skip *int32) (result ListImage, err error) {
  2842  	if tracing.IsEnabled() {
  2843  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetTaggedImages")
  2844  		defer func() {
  2845  			sc := -1
  2846  			if result.Response.Response != nil {
  2847  				sc = result.Response.Response.StatusCode
  2848  			}
  2849  			tracing.EndSpan(ctx, sc, err)
  2850  		}()
  2851  	}
  2852  	if err := validation.Validate([]validation.Validation{
  2853  		{TargetValue: tagIds,
  2854  			Constraints: []validation.Constraint{{Target: "tagIds", Name: validation.Null, Rule: false,
  2855  				Chain: []validation.Constraint{{Target: "tagIds", Name: validation.MaxItems, Rule: 20, Chain: nil},
  2856  					{Target: "tagIds", Name: validation.MinItems, Rule: 0, Chain: nil},
  2857  				}}}},
  2858  		{TargetValue: take,
  2859  			Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false,
  2860  				Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(256), Chain: nil},
  2861  					{Target: "take", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
  2862  				}}}}}); err != nil {
  2863  		return result, validation.NewError("training.BaseClient", "GetTaggedImages", err.Error())
  2864  	}
  2865  
  2866  	req, err := client.GetTaggedImagesPreparer(ctx, projectID, iterationID, tagIds, orderBy, take, skip)
  2867  	if err != nil {
  2868  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTaggedImages", nil, "Failure preparing request")
  2869  		return
  2870  	}
  2871  
  2872  	resp, err := client.GetTaggedImagesSender(req)
  2873  	if err != nil {
  2874  		result.Response = autorest.Response{Response: resp}
  2875  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTaggedImages", resp, "Failure sending request")
  2876  		return
  2877  	}
  2878  
  2879  	result, err = client.GetTaggedImagesResponder(resp)
  2880  	if err != nil {
  2881  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTaggedImages", resp, "Failure responding to request")
  2882  		return
  2883  	}
  2884  
  2885  	return
  2886  }
  2887  
  2888  // GetTaggedImagesPreparer prepares the GetTaggedImages request.
  2889  func (client BaseClient) GetTaggedImagesPreparer(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID, tagIds []uuid.UUID, orderBy string, take *int32, skip *int32) (*http.Request, error) {
  2890  	urlParameters := map[string]interface{}{
  2891  		"Endpoint": client.Endpoint,
  2892  	}
  2893  
  2894  	pathParameters := map[string]interface{}{
  2895  		"projectId": autorest.Encode("path", projectID),
  2896  	}
  2897  
  2898  	queryParameters := map[string]interface{}{}
  2899  	if iterationID != nil {
  2900  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  2901  	}
  2902  	if tagIds != nil && len(tagIds) > 0 {
  2903  		queryParameters["tagIds"] = autorest.Encode("query", tagIds, ",")
  2904  	}
  2905  	if len(string(orderBy)) > 0 {
  2906  		queryParameters["orderBy"] = autorest.Encode("query", orderBy)
  2907  	}
  2908  	if take != nil {
  2909  		queryParameters["take"] = autorest.Encode("query", *take)
  2910  	} else {
  2911  		queryParameters["take"] = autorest.Encode("query", 50)
  2912  	}
  2913  	if skip != nil {
  2914  		queryParameters["skip"] = autorest.Encode("query", *skip)
  2915  	} else {
  2916  		queryParameters["skip"] = autorest.Encode("query", 0)
  2917  	}
  2918  
  2919  	preparer := autorest.CreatePreparer(
  2920  		autorest.AsGet(),
  2921  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  2922  		autorest.WithPathParameters("/projects/{projectId}/images/tagged", pathParameters),
  2923  		autorest.WithQueryParameters(queryParameters))
  2924  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  2925  }
  2926  
  2927  // GetTaggedImagesSender sends the GetTaggedImages request. The method will close the
  2928  // http.Response Body if it receives an error.
  2929  func (client BaseClient) GetTaggedImagesSender(req *http.Request) (*http.Response, error) {
  2930  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  2931  }
  2932  
  2933  // GetTaggedImagesResponder handles the response to the GetTaggedImages request. The method always
  2934  // closes the http.Response Body.
  2935  func (client BaseClient) GetTaggedImagesResponder(resp *http.Response) (result ListImage, err error) {
  2936  	err = autorest.Respond(
  2937  		resp,
  2938  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  2939  		autorest.ByUnmarshallingJSON(&result.Value),
  2940  		autorest.ByClosing())
  2941  	result.Response = autorest.Response{Response: resp}
  2942  	return
  2943  }
  2944  
  2945  // GetTags sends the get tags request.
  2946  // Parameters:
  2947  // projectID - the project id.
  2948  // iterationID - the iteration id. Defaults to workspace.
  2949  func (client BaseClient) GetTags(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID) (result ListTag, err error) {
  2950  	if tracing.IsEnabled() {
  2951  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetTags")
  2952  		defer func() {
  2953  			sc := -1
  2954  			if result.Response.Response != nil {
  2955  				sc = result.Response.Response.StatusCode
  2956  			}
  2957  			tracing.EndSpan(ctx, sc, err)
  2958  		}()
  2959  	}
  2960  	req, err := client.GetTagsPreparer(ctx, projectID, iterationID)
  2961  	if err != nil {
  2962  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTags", nil, "Failure preparing request")
  2963  		return
  2964  	}
  2965  
  2966  	resp, err := client.GetTagsSender(req)
  2967  	if err != nil {
  2968  		result.Response = autorest.Response{Response: resp}
  2969  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTags", resp, "Failure sending request")
  2970  		return
  2971  	}
  2972  
  2973  	result, err = client.GetTagsResponder(resp)
  2974  	if err != nil {
  2975  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetTags", resp, "Failure responding to request")
  2976  		return
  2977  	}
  2978  
  2979  	return
  2980  }
  2981  
  2982  // GetTagsPreparer prepares the GetTags request.
  2983  func (client BaseClient) GetTagsPreparer(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID) (*http.Request, error) {
  2984  	urlParameters := map[string]interface{}{
  2985  		"Endpoint": client.Endpoint,
  2986  	}
  2987  
  2988  	pathParameters := map[string]interface{}{
  2989  		"projectId": autorest.Encode("path", projectID),
  2990  	}
  2991  
  2992  	queryParameters := map[string]interface{}{}
  2993  	if iterationID != nil {
  2994  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  2995  	}
  2996  
  2997  	preparer := autorest.CreatePreparer(
  2998  		autorest.AsGet(),
  2999  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3000  		autorest.WithPathParameters("/projects/{projectId}/tags", pathParameters),
  3001  		autorest.WithQueryParameters(queryParameters))
  3002  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3003  }
  3004  
  3005  // GetTagsSender sends the GetTags request. The method will close the
  3006  // http.Response Body if it receives an error.
  3007  func (client BaseClient) GetTagsSender(req *http.Request) (*http.Response, error) {
  3008  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3009  }
  3010  
  3011  // GetTagsResponder handles the response to the GetTags request. The method always
  3012  // closes the http.Response Body.
  3013  func (client BaseClient) GetTagsResponder(resp *http.Response) (result ListTag, err error) {
  3014  	err = autorest.Respond(
  3015  		resp,
  3016  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3017  		autorest.ByUnmarshallingJSON(&result.Value),
  3018  		autorest.ByClosing())
  3019  	result.Response = autorest.Response{Response: resp}
  3020  	return
  3021  }
  3022  
  3023  // GetUntaggedImageCount this API returns the images which have no tags for a given project and optionally an
  3024  // iteration. If no iteration is specified the
  3025  // current workspace is used.
  3026  // Parameters:
  3027  // projectID - the project id.
  3028  // iterationID - the iteration id. Defaults to workspace.
  3029  func (client BaseClient) GetUntaggedImageCount(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID) (result Int32, err error) {
  3030  	if tracing.IsEnabled() {
  3031  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetUntaggedImageCount")
  3032  		defer func() {
  3033  			sc := -1
  3034  			if result.Response.Response != nil {
  3035  				sc = result.Response.Response.StatusCode
  3036  			}
  3037  			tracing.EndSpan(ctx, sc, err)
  3038  		}()
  3039  	}
  3040  	req, err := client.GetUntaggedImageCountPreparer(ctx, projectID, iterationID)
  3041  	if err != nil {
  3042  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetUntaggedImageCount", nil, "Failure preparing request")
  3043  		return
  3044  	}
  3045  
  3046  	resp, err := client.GetUntaggedImageCountSender(req)
  3047  	if err != nil {
  3048  		result.Response = autorest.Response{Response: resp}
  3049  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetUntaggedImageCount", resp, "Failure sending request")
  3050  		return
  3051  	}
  3052  
  3053  	result, err = client.GetUntaggedImageCountResponder(resp)
  3054  	if err != nil {
  3055  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetUntaggedImageCount", resp, "Failure responding to request")
  3056  		return
  3057  	}
  3058  
  3059  	return
  3060  }
  3061  
  3062  // GetUntaggedImageCountPreparer prepares the GetUntaggedImageCount request.
  3063  func (client BaseClient) GetUntaggedImageCountPreparer(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID) (*http.Request, error) {
  3064  	urlParameters := map[string]interface{}{
  3065  		"Endpoint": client.Endpoint,
  3066  	}
  3067  
  3068  	pathParameters := map[string]interface{}{
  3069  		"projectId": autorest.Encode("path", projectID),
  3070  	}
  3071  
  3072  	queryParameters := map[string]interface{}{}
  3073  	if iterationID != nil {
  3074  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  3075  	}
  3076  
  3077  	preparer := autorest.CreatePreparer(
  3078  		autorest.AsGet(),
  3079  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3080  		autorest.WithPathParameters("/projects/{projectId}/images/untagged/count", pathParameters),
  3081  		autorest.WithQueryParameters(queryParameters))
  3082  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3083  }
  3084  
  3085  // GetUntaggedImageCountSender sends the GetUntaggedImageCount request. The method will close the
  3086  // http.Response Body if it receives an error.
  3087  func (client BaseClient) GetUntaggedImageCountSender(req *http.Request) (*http.Response, error) {
  3088  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3089  }
  3090  
  3091  // GetUntaggedImageCountResponder handles the response to the GetUntaggedImageCount request. The method always
  3092  // closes the http.Response Body.
  3093  func (client BaseClient) GetUntaggedImageCountResponder(resp *http.Response) (result Int32, err error) {
  3094  	err = autorest.Respond(
  3095  		resp,
  3096  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3097  		autorest.ByUnmarshallingJSON(&result.Value),
  3098  		autorest.ByClosing())
  3099  	result.Response = autorest.Response{Response: resp}
  3100  	return
  3101  }
  3102  
  3103  // GetUntaggedImages this API supports batching and range selection. By default it will only return first 50 images
  3104  // matching images.
  3105  // Use the {take} and {skip} parameters to control how many images to return in a given batch.
  3106  // Parameters:
  3107  // projectID - the project id.
  3108  // iterationID - the iteration id. Defaults to workspace.
  3109  // orderBy - the ordering. Defaults to newest.
  3110  // take - maximum number of images to return. Defaults to 50, limited to 256.
  3111  // skip - number of images to skip before beginning the image batch. Defaults to 0.
  3112  func (client BaseClient) GetUntaggedImages(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID, orderBy string, take *int32, skip *int32) (result ListImage, err error) {
  3113  	if tracing.IsEnabled() {
  3114  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetUntaggedImages")
  3115  		defer func() {
  3116  			sc := -1
  3117  			if result.Response.Response != nil {
  3118  				sc = result.Response.Response.StatusCode
  3119  			}
  3120  			tracing.EndSpan(ctx, sc, err)
  3121  		}()
  3122  	}
  3123  	if err := validation.Validate([]validation.Validation{
  3124  		{TargetValue: take,
  3125  			Constraints: []validation.Constraint{{Target: "take", Name: validation.Null, Rule: false,
  3126  				Chain: []validation.Constraint{{Target: "take", Name: validation.InclusiveMaximum, Rule: int64(256), Chain: nil},
  3127  					{Target: "take", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
  3128  				}}}}}); err != nil {
  3129  		return result, validation.NewError("training.BaseClient", "GetUntaggedImages", err.Error())
  3130  	}
  3131  
  3132  	req, err := client.GetUntaggedImagesPreparer(ctx, projectID, iterationID, orderBy, take, skip)
  3133  	if err != nil {
  3134  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetUntaggedImages", nil, "Failure preparing request")
  3135  		return
  3136  	}
  3137  
  3138  	resp, err := client.GetUntaggedImagesSender(req)
  3139  	if err != nil {
  3140  		result.Response = autorest.Response{Response: resp}
  3141  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetUntaggedImages", resp, "Failure sending request")
  3142  		return
  3143  	}
  3144  
  3145  	result, err = client.GetUntaggedImagesResponder(resp)
  3146  	if err != nil {
  3147  		err = autorest.NewErrorWithError(err, "training.BaseClient", "GetUntaggedImages", resp, "Failure responding to request")
  3148  		return
  3149  	}
  3150  
  3151  	return
  3152  }
  3153  
  3154  // GetUntaggedImagesPreparer prepares the GetUntaggedImages request.
  3155  func (client BaseClient) GetUntaggedImagesPreparer(ctx context.Context, projectID uuid.UUID, iterationID *uuid.UUID, orderBy string, take *int32, skip *int32) (*http.Request, error) {
  3156  	urlParameters := map[string]interface{}{
  3157  		"Endpoint": client.Endpoint,
  3158  	}
  3159  
  3160  	pathParameters := map[string]interface{}{
  3161  		"projectId": autorest.Encode("path", projectID),
  3162  	}
  3163  
  3164  	queryParameters := map[string]interface{}{}
  3165  	if iterationID != nil {
  3166  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  3167  	}
  3168  	if len(string(orderBy)) > 0 {
  3169  		queryParameters["orderBy"] = autorest.Encode("query", orderBy)
  3170  	}
  3171  	if take != nil {
  3172  		queryParameters["take"] = autorest.Encode("query", *take)
  3173  	} else {
  3174  		queryParameters["take"] = autorest.Encode("query", 50)
  3175  	}
  3176  	if skip != nil {
  3177  		queryParameters["skip"] = autorest.Encode("query", *skip)
  3178  	} else {
  3179  		queryParameters["skip"] = autorest.Encode("query", 0)
  3180  	}
  3181  
  3182  	preparer := autorest.CreatePreparer(
  3183  		autorest.AsGet(),
  3184  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3185  		autorest.WithPathParameters("/projects/{projectId}/images/untagged", pathParameters),
  3186  		autorest.WithQueryParameters(queryParameters))
  3187  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3188  }
  3189  
  3190  // GetUntaggedImagesSender sends the GetUntaggedImages request. The method will close the
  3191  // http.Response Body if it receives an error.
  3192  func (client BaseClient) GetUntaggedImagesSender(req *http.Request) (*http.Response, error) {
  3193  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3194  }
  3195  
  3196  // GetUntaggedImagesResponder handles the response to the GetUntaggedImages request. The method always
  3197  // closes the http.Response Body.
  3198  func (client BaseClient) GetUntaggedImagesResponder(resp *http.Response) (result ListImage, err error) {
  3199  	err = autorest.Respond(
  3200  		resp,
  3201  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3202  		autorest.ByUnmarshallingJSON(&result.Value),
  3203  		autorest.ByClosing())
  3204  	result.Response = autorest.Response{Response: resp}
  3205  	return
  3206  }
  3207  
  3208  // ImportProject sends the import project request.
  3209  // Parameters:
  3210  // tokenParameter - token generated from the export project call.
  3211  // name - optional, name of the project to use instead of auto-generated name.
  3212  func (client BaseClient) ImportProject(ctx context.Context, tokenParameter string, name string) (result Project, err error) {
  3213  	if tracing.IsEnabled() {
  3214  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ImportProject")
  3215  		defer func() {
  3216  			sc := -1
  3217  			if result.Response.Response != nil {
  3218  				sc = result.Response.Response.StatusCode
  3219  			}
  3220  			tracing.EndSpan(ctx, sc, err)
  3221  		}()
  3222  	}
  3223  	req, err := client.ImportProjectPreparer(ctx, tokenParameter, name)
  3224  	if err != nil {
  3225  		err = autorest.NewErrorWithError(err, "training.BaseClient", "ImportProject", nil, "Failure preparing request")
  3226  		return
  3227  	}
  3228  
  3229  	resp, err := client.ImportProjectSender(req)
  3230  	if err != nil {
  3231  		result.Response = autorest.Response{Response: resp}
  3232  		err = autorest.NewErrorWithError(err, "training.BaseClient", "ImportProject", resp, "Failure sending request")
  3233  		return
  3234  	}
  3235  
  3236  	result, err = client.ImportProjectResponder(resp)
  3237  	if err != nil {
  3238  		err = autorest.NewErrorWithError(err, "training.BaseClient", "ImportProject", resp, "Failure responding to request")
  3239  		return
  3240  	}
  3241  
  3242  	return
  3243  }
  3244  
  3245  // ImportProjectPreparer prepares the ImportProject request.
  3246  func (client BaseClient) ImportProjectPreparer(ctx context.Context, tokenParameter string, name string) (*http.Request, error) {
  3247  	urlParameters := map[string]interface{}{
  3248  		"Endpoint": client.Endpoint,
  3249  	}
  3250  
  3251  	queryParameters := map[string]interface{}{
  3252  		"token": autorest.Encode("query", tokenParameter),
  3253  	}
  3254  	if len(name) > 0 {
  3255  		queryParameters["name"] = autorest.Encode("query", name)
  3256  	}
  3257  
  3258  	preparer := autorest.CreatePreparer(
  3259  		autorest.AsPost(),
  3260  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3261  		autorest.WithPath("/projects/import"),
  3262  		autorest.WithQueryParameters(queryParameters))
  3263  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3264  }
  3265  
  3266  // ImportProjectSender sends the ImportProject request. The method will close the
  3267  // http.Response Body if it receives an error.
  3268  func (client BaseClient) ImportProjectSender(req *http.Request) (*http.Response, error) {
  3269  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3270  }
  3271  
  3272  // ImportProjectResponder handles the response to the ImportProject request. The method always
  3273  // closes the http.Response Body.
  3274  func (client BaseClient) ImportProjectResponder(resp *http.Response) (result Project, err error) {
  3275  	err = autorest.Respond(
  3276  		resp,
  3277  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3278  		autorest.ByUnmarshallingJSON(&result),
  3279  		autorest.ByClosing())
  3280  	result.Response = autorest.Response{Response: resp}
  3281  	return
  3282  }
  3283  
  3284  // PublishIteration sends the publish iteration request.
  3285  // Parameters:
  3286  // projectID - the project id.
  3287  // iterationID - the iteration id.
  3288  // publishName - the name to give the published iteration.
  3289  // predictionID - the id of the prediction resource to publish to.
  3290  // overwrite - whether to overwrite the published model with the given name (default: false).
  3291  func (client BaseClient) PublishIteration(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, publishName string, predictionID string, overwrite *bool) (result Bool, err error) {
  3292  	if tracing.IsEnabled() {
  3293  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PublishIteration")
  3294  		defer func() {
  3295  			sc := -1
  3296  			if result.Response.Response != nil {
  3297  				sc = result.Response.Response.StatusCode
  3298  			}
  3299  			tracing.EndSpan(ctx, sc, err)
  3300  		}()
  3301  	}
  3302  	req, err := client.PublishIterationPreparer(ctx, projectID, iterationID, publishName, predictionID, overwrite)
  3303  	if err != nil {
  3304  		err = autorest.NewErrorWithError(err, "training.BaseClient", "PublishIteration", nil, "Failure preparing request")
  3305  		return
  3306  	}
  3307  
  3308  	resp, err := client.PublishIterationSender(req)
  3309  	if err != nil {
  3310  		result.Response = autorest.Response{Response: resp}
  3311  		err = autorest.NewErrorWithError(err, "training.BaseClient", "PublishIteration", resp, "Failure sending request")
  3312  		return
  3313  	}
  3314  
  3315  	result, err = client.PublishIterationResponder(resp)
  3316  	if err != nil {
  3317  		err = autorest.NewErrorWithError(err, "training.BaseClient", "PublishIteration", resp, "Failure responding to request")
  3318  		return
  3319  	}
  3320  
  3321  	return
  3322  }
  3323  
  3324  // PublishIterationPreparer prepares the PublishIteration request.
  3325  func (client BaseClient) PublishIterationPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, publishName string, predictionID string, overwrite *bool) (*http.Request, error) {
  3326  	urlParameters := map[string]interface{}{
  3327  		"Endpoint": client.Endpoint,
  3328  	}
  3329  
  3330  	pathParameters := map[string]interface{}{
  3331  		"iterationId": autorest.Encode("path", iterationID),
  3332  		"projectId":   autorest.Encode("path", projectID),
  3333  	}
  3334  
  3335  	queryParameters := map[string]interface{}{
  3336  		"predictionId": autorest.Encode("query", predictionID),
  3337  		"publishName":  autorest.Encode("query", publishName),
  3338  	}
  3339  	if overwrite != nil {
  3340  		queryParameters["overwrite"] = autorest.Encode("query", *overwrite)
  3341  	}
  3342  
  3343  	preparer := autorest.CreatePreparer(
  3344  		autorest.AsPost(),
  3345  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3346  		autorest.WithPathParameters("/projects/{projectId}/iterations/{iterationId}/publish", pathParameters),
  3347  		autorest.WithQueryParameters(queryParameters))
  3348  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3349  }
  3350  
  3351  // PublishIterationSender sends the PublishIteration request. The method will close the
  3352  // http.Response Body if it receives an error.
  3353  func (client BaseClient) PublishIterationSender(req *http.Request) (*http.Response, error) {
  3354  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3355  }
  3356  
  3357  // PublishIterationResponder handles the response to the PublishIteration request. The method always
  3358  // closes the http.Response Body.
  3359  func (client BaseClient) PublishIterationResponder(resp *http.Response) (result Bool, err error) {
  3360  	err = autorest.Respond(
  3361  		resp,
  3362  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3363  		autorest.ByUnmarshallingJSON(&result.Value),
  3364  		autorest.ByClosing())
  3365  	result.Response = autorest.Response{Response: resp}
  3366  	return
  3367  }
  3368  
  3369  // QueryPredictions sends the query predictions request.
  3370  // Parameters:
  3371  // projectID - the project id.
  3372  // query - parameters used to query the predictions. Limited to combining 2 tags.
  3373  func (client BaseClient) QueryPredictions(ctx context.Context, projectID uuid.UUID, query PredictionQueryToken) (result PredictionQueryResult, err error) {
  3374  	if tracing.IsEnabled() {
  3375  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.QueryPredictions")
  3376  		defer func() {
  3377  			sc := -1
  3378  			if result.Response.Response != nil {
  3379  				sc = result.Response.Response.StatusCode
  3380  			}
  3381  			tracing.EndSpan(ctx, sc, err)
  3382  		}()
  3383  	}
  3384  	req, err := client.QueryPredictionsPreparer(ctx, projectID, query)
  3385  	if err != nil {
  3386  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QueryPredictions", nil, "Failure preparing request")
  3387  		return
  3388  	}
  3389  
  3390  	resp, err := client.QueryPredictionsSender(req)
  3391  	if err != nil {
  3392  		result.Response = autorest.Response{Response: resp}
  3393  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QueryPredictions", resp, "Failure sending request")
  3394  		return
  3395  	}
  3396  
  3397  	result, err = client.QueryPredictionsResponder(resp)
  3398  	if err != nil {
  3399  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QueryPredictions", resp, "Failure responding to request")
  3400  		return
  3401  	}
  3402  
  3403  	return
  3404  }
  3405  
  3406  // QueryPredictionsPreparer prepares the QueryPredictions request.
  3407  func (client BaseClient) QueryPredictionsPreparer(ctx context.Context, projectID uuid.UUID, query PredictionQueryToken) (*http.Request, error) {
  3408  	urlParameters := map[string]interface{}{
  3409  		"Endpoint": client.Endpoint,
  3410  	}
  3411  
  3412  	pathParameters := map[string]interface{}{
  3413  		"projectId": autorest.Encode("path", projectID),
  3414  	}
  3415  
  3416  	preparer := autorest.CreatePreparer(
  3417  		autorest.AsContentType("application/json; charset=utf-8"),
  3418  		autorest.AsPost(),
  3419  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3420  		autorest.WithPathParameters("/projects/{projectId}/predictions/query", pathParameters),
  3421  		autorest.WithJSON(query))
  3422  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3423  }
  3424  
  3425  // QueryPredictionsSender sends the QueryPredictions request. The method will close the
  3426  // http.Response Body if it receives an error.
  3427  func (client BaseClient) QueryPredictionsSender(req *http.Request) (*http.Response, error) {
  3428  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3429  }
  3430  
  3431  // QueryPredictionsResponder handles the response to the QueryPredictions request. The method always
  3432  // closes the http.Response Body.
  3433  func (client BaseClient) QueryPredictionsResponder(resp *http.Response) (result PredictionQueryResult, err error) {
  3434  	err = autorest.Respond(
  3435  		resp,
  3436  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3437  		autorest.ByUnmarshallingJSON(&result),
  3438  		autorest.ByClosing())
  3439  	result.Response = autorest.Response{Response: resp}
  3440  	return
  3441  }
  3442  
  3443  // QuerySuggestedImageCount this API takes in tagIds to get count of untagged images per suggested tags for a given
  3444  // threshold.
  3445  // Parameters:
  3446  // projectID - the project id.
  3447  // iterationID - iterationId to use for the suggested tags and regions.
  3448  // query - model that contains tagIds, threshold and projectType to query by.
  3449  func (client BaseClient) QuerySuggestedImageCount(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, query TagFilter) (result SetInt32, err error) {
  3450  	if tracing.IsEnabled() {
  3451  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.QuerySuggestedImageCount")
  3452  		defer func() {
  3453  			sc := -1
  3454  			if result.Response.Response != nil {
  3455  				sc = result.Response.Response.StatusCode
  3456  			}
  3457  			tracing.EndSpan(ctx, sc, err)
  3458  		}()
  3459  	}
  3460  	req, err := client.QuerySuggestedImageCountPreparer(ctx, projectID, iterationID, query)
  3461  	if err != nil {
  3462  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuerySuggestedImageCount", nil, "Failure preparing request")
  3463  		return
  3464  	}
  3465  
  3466  	resp, err := client.QuerySuggestedImageCountSender(req)
  3467  	if err != nil {
  3468  		result.Response = autorest.Response{Response: resp}
  3469  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuerySuggestedImageCount", resp, "Failure sending request")
  3470  		return
  3471  	}
  3472  
  3473  	result, err = client.QuerySuggestedImageCountResponder(resp)
  3474  	if err != nil {
  3475  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuerySuggestedImageCount", resp, "Failure responding to request")
  3476  		return
  3477  	}
  3478  
  3479  	return
  3480  }
  3481  
  3482  // QuerySuggestedImageCountPreparer prepares the QuerySuggestedImageCount request.
  3483  func (client BaseClient) QuerySuggestedImageCountPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, query TagFilter) (*http.Request, error) {
  3484  	urlParameters := map[string]interface{}{
  3485  		"Endpoint": client.Endpoint,
  3486  	}
  3487  
  3488  	pathParameters := map[string]interface{}{
  3489  		"projectId": autorest.Encode("path", projectID),
  3490  	}
  3491  
  3492  	queryParameters := map[string]interface{}{
  3493  		"iterationId": autorest.Encode("query", iterationID),
  3494  	}
  3495  
  3496  	preparer := autorest.CreatePreparer(
  3497  		autorest.AsContentType("application/json; charset=utf-8"),
  3498  		autorest.AsPost(),
  3499  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3500  		autorest.WithPathParameters("/projects/{projectId}/images/suggested/count", pathParameters),
  3501  		autorest.WithJSON(query),
  3502  		autorest.WithQueryParameters(queryParameters))
  3503  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3504  }
  3505  
  3506  // QuerySuggestedImageCountSender sends the QuerySuggestedImageCount request. The method will close the
  3507  // http.Response Body if it receives an error.
  3508  func (client BaseClient) QuerySuggestedImageCountSender(req *http.Request) (*http.Response, error) {
  3509  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3510  }
  3511  
  3512  // QuerySuggestedImageCountResponder handles the response to the QuerySuggestedImageCount request. The method always
  3513  // closes the http.Response Body.
  3514  func (client BaseClient) QuerySuggestedImageCountResponder(resp *http.Response) (result SetInt32, err error) {
  3515  	err = autorest.Respond(
  3516  		resp,
  3517  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3518  		autorest.ByUnmarshallingJSON(&result.Value),
  3519  		autorest.ByClosing())
  3520  	result.Response = autorest.Response{Response: resp}
  3521  	return
  3522  }
  3523  
  3524  // QuerySuggestedImages this API will fetch untagged images filtered by suggested tags Ids. It returns an empty array
  3525  // if no images are found.
  3526  // Parameters:
  3527  // projectID - the project id.
  3528  // iterationID - iterationId to use for the suggested tags and regions.
  3529  // query - contains properties we need to query suggested images.
  3530  func (client BaseClient) QuerySuggestedImages(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, query SuggestedTagAndRegionQueryToken) (result SuggestedTagAndRegionQuery, err error) {
  3531  	if tracing.IsEnabled() {
  3532  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.QuerySuggestedImages")
  3533  		defer func() {
  3534  			sc := -1
  3535  			if result.Response.Response != nil {
  3536  				sc = result.Response.Response.StatusCode
  3537  			}
  3538  			tracing.EndSpan(ctx, sc, err)
  3539  		}()
  3540  	}
  3541  	req, err := client.QuerySuggestedImagesPreparer(ctx, projectID, iterationID, query)
  3542  	if err != nil {
  3543  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuerySuggestedImages", nil, "Failure preparing request")
  3544  		return
  3545  	}
  3546  
  3547  	resp, err := client.QuerySuggestedImagesSender(req)
  3548  	if err != nil {
  3549  		result.Response = autorest.Response{Response: resp}
  3550  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuerySuggestedImages", resp, "Failure sending request")
  3551  		return
  3552  	}
  3553  
  3554  	result, err = client.QuerySuggestedImagesResponder(resp)
  3555  	if err != nil {
  3556  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuerySuggestedImages", resp, "Failure responding to request")
  3557  		return
  3558  	}
  3559  
  3560  	return
  3561  }
  3562  
  3563  // QuerySuggestedImagesPreparer prepares the QuerySuggestedImages request.
  3564  func (client BaseClient) QuerySuggestedImagesPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, query SuggestedTagAndRegionQueryToken) (*http.Request, error) {
  3565  	urlParameters := map[string]interface{}{
  3566  		"Endpoint": client.Endpoint,
  3567  	}
  3568  
  3569  	pathParameters := map[string]interface{}{
  3570  		"projectId": autorest.Encode("path", projectID),
  3571  	}
  3572  
  3573  	queryParameters := map[string]interface{}{
  3574  		"iterationId": autorest.Encode("query", iterationID),
  3575  	}
  3576  
  3577  	preparer := autorest.CreatePreparer(
  3578  		autorest.AsContentType("application/json; charset=utf-8"),
  3579  		autorest.AsPost(),
  3580  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3581  		autorest.WithPathParameters("/projects/{projectId}/images/suggested", pathParameters),
  3582  		autorest.WithJSON(query),
  3583  		autorest.WithQueryParameters(queryParameters))
  3584  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3585  }
  3586  
  3587  // QuerySuggestedImagesSender sends the QuerySuggestedImages request. The method will close the
  3588  // http.Response Body if it receives an error.
  3589  func (client BaseClient) QuerySuggestedImagesSender(req *http.Request) (*http.Response, error) {
  3590  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3591  }
  3592  
  3593  // QuerySuggestedImagesResponder handles the response to the QuerySuggestedImages request. The method always
  3594  // closes the http.Response Body.
  3595  func (client BaseClient) QuerySuggestedImagesResponder(resp *http.Response) (result SuggestedTagAndRegionQuery, err error) {
  3596  	err = autorest.Respond(
  3597  		resp,
  3598  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3599  		autorest.ByUnmarshallingJSON(&result),
  3600  		autorest.ByClosing())
  3601  	result.Response = autorest.Response{Response: resp}
  3602  	return
  3603  }
  3604  
  3605  // QuickTestImage sends the quick test image request.
  3606  // Parameters:
  3607  // projectID - the project id.
  3608  // imageData - binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB.
  3609  // iterationID - optional. Specifies the id of a particular iteration to evaluate against.
  3610  // The default iteration for the project will be used when not specified.
  3611  // store - optional. Specifies whether or not to store the result of this prediction. The default is true, to
  3612  // store.
  3613  func (client BaseClient) QuickTestImage(ctx context.Context, projectID uuid.UUID, imageData io.ReadCloser, iterationID *uuid.UUID, store *bool) (result ImagePrediction, err error) {
  3614  	if tracing.IsEnabled() {
  3615  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.QuickTestImage")
  3616  		defer func() {
  3617  			sc := -1
  3618  			if result.Response.Response != nil {
  3619  				sc = result.Response.Response.StatusCode
  3620  			}
  3621  			tracing.EndSpan(ctx, sc, err)
  3622  		}()
  3623  	}
  3624  	req, err := client.QuickTestImagePreparer(ctx, projectID, imageData, iterationID, store)
  3625  	if err != nil {
  3626  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuickTestImage", nil, "Failure preparing request")
  3627  		return
  3628  	}
  3629  
  3630  	resp, err := client.QuickTestImageSender(req)
  3631  	if err != nil {
  3632  		result.Response = autorest.Response{Response: resp}
  3633  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuickTestImage", resp, "Failure sending request")
  3634  		return
  3635  	}
  3636  
  3637  	result, err = client.QuickTestImageResponder(resp)
  3638  	if err != nil {
  3639  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuickTestImage", resp, "Failure responding to request")
  3640  		return
  3641  	}
  3642  
  3643  	return
  3644  }
  3645  
  3646  // QuickTestImagePreparer prepares the QuickTestImage request.
  3647  func (client BaseClient) QuickTestImagePreparer(ctx context.Context, projectID uuid.UUID, imageData io.ReadCloser, iterationID *uuid.UUID, store *bool) (*http.Request, error) {
  3648  	urlParameters := map[string]interface{}{
  3649  		"Endpoint": client.Endpoint,
  3650  	}
  3651  
  3652  	pathParameters := map[string]interface{}{
  3653  		"projectId": autorest.Encode("path", projectID),
  3654  	}
  3655  
  3656  	queryParameters := map[string]interface{}{}
  3657  	if iterationID != nil {
  3658  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  3659  	}
  3660  	if store != nil {
  3661  		queryParameters["store"] = autorest.Encode("query", *store)
  3662  	} else {
  3663  		queryParameters["store"] = autorest.Encode("query", true)
  3664  	}
  3665  
  3666  	formDataParameters := map[string]interface{}{
  3667  		"imageData": imageData,
  3668  	}
  3669  
  3670  	preparer := autorest.CreatePreparer(
  3671  		autorest.AsPost(),
  3672  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3673  		autorest.WithPathParameters("/projects/{projectId}/quicktest/image", pathParameters),
  3674  		autorest.WithQueryParameters(queryParameters),
  3675  		autorest.WithMultiPartFormData(formDataParameters))
  3676  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3677  }
  3678  
  3679  // QuickTestImageSender sends the QuickTestImage request. The method will close the
  3680  // http.Response Body if it receives an error.
  3681  func (client BaseClient) QuickTestImageSender(req *http.Request) (*http.Response, error) {
  3682  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3683  }
  3684  
  3685  // QuickTestImageResponder handles the response to the QuickTestImage request. The method always
  3686  // closes the http.Response Body.
  3687  func (client BaseClient) QuickTestImageResponder(resp *http.Response) (result ImagePrediction, err error) {
  3688  	err = autorest.Respond(
  3689  		resp,
  3690  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3691  		autorest.ByUnmarshallingJSON(&result),
  3692  		autorest.ByClosing())
  3693  	result.Response = autorest.Response{Response: resp}
  3694  	return
  3695  }
  3696  
  3697  // QuickTestImageURL sends the quick test image url request.
  3698  // Parameters:
  3699  // projectID - the project to evaluate against.
  3700  // imageURL - an ImageUrl that contains the url of the image to be evaluated.
  3701  // iterationID - optional. Specifies the id of a particular iteration to evaluate against.
  3702  // The default iteration for the project will be used when not specified.
  3703  // store - optional. Specifies whether or not to store the result of this prediction. The default is true, to
  3704  // store.
  3705  func (client BaseClient) QuickTestImageURL(ctx context.Context, projectID uuid.UUID, imageURL ImageURL, iterationID *uuid.UUID, store *bool) (result ImagePrediction, err error) {
  3706  	if tracing.IsEnabled() {
  3707  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.QuickTestImageURL")
  3708  		defer func() {
  3709  			sc := -1
  3710  			if result.Response.Response != nil {
  3711  				sc = result.Response.Response.StatusCode
  3712  			}
  3713  			tracing.EndSpan(ctx, sc, err)
  3714  		}()
  3715  	}
  3716  	if err := validation.Validate([]validation.Validation{
  3717  		{TargetValue: imageURL,
  3718  			Constraints: []validation.Constraint{{Target: "imageURL.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
  3719  		return result, validation.NewError("training.BaseClient", "QuickTestImageURL", err.Error())
  3720  	}
  3721  
  3722  	req, err := client.QuickTestImageURLPreparer(ctx, projectID, imageURL, iterationID, store)
  3723  	if err != nil {
  3724  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuickTestImageURL", nil, "Failure preparing request")
  3725  		return
  3726  	}
  3727  
  3728  	resp, err := client.QuickTestImageURLSender(req)
  3729  	if err != nil {
  3730  		result.Response = autorest.Response{Response: resp}
  3731  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuickTestImageURL", resp, "Failure sending request")
  3732  		return
  3733  	}
  3734  
  3735  	result, err = client.QuickTestImageURLResponder(resp)
  3736  	if err != nil {
  3737  		err = autorest.NewErrorWithError(err, "training.BaseClient", "QuickTestImageURL", resp, "Failure responding to request")
  3738  		return
  3739  	}
  3740  
  3741  	return
  3742  }
  3743  
  3744  // QuickTestImageURLPreparer prepares the QuickTestImageURL request.
  3745  func (client BaseClient) QuickTestImageURLPreparer(ctx context.Context, projectID uuid.UUID, imageURL ImageURL, iterationID *uuid.UUID, store *bool) (*http.Request, error) {
  3746  	urlParameters := map[string]interface{}{
  3747  		"Endpoint": client.Endpoint,
  3748  	}
  3749  
  3750  	pathParameters := map[string]interface{}{
  3751  		"projectId": autorest.Encode("path", projectID),
  3752  	}
  3753  
  3754  	queryParameters := map[string]interface{}{}
  3755  	if iterationID != nil {
  3756  		queryParameters["iterationId"] = autorest.Encode("query", *iterationID)
  3757  	}
  3758  	if store != nil {
  3759  		queryParameters["store"] = autorest.Encode("query", *store)
  3760  	} else {
  3761  		queryParameters["store"] = autorest.Encode("query", true)
  3762  	}
  3763  
  3764  	preparer := autorest.CreatePreparer(
  3765  		autorest.AsContentType("application/json; charset=utf-8"),
  3766  		autorest.AsPost(),
  3767  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3768  		autorest.WithPathParameters("/projects/{projectId}/quicktest/url", pathParameters),
  3769  		autorest.WithJSON(imageURL),
  3770  		autorest.WithQueryParameters(queryParameters))
  3771  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3772  }
  3773  
  3774  // QuickTestImageURLSender sends the QuickTestImageURL request. The method will close the
  3775  // http.Response Body if it receives an error.
  3776  func (client BaseClient) QuickTestImageURLSender(req *http.Request) (*http.Response, error) {
  3777  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3778  }
  3779  
  3780  // QuickTestImageURLResponder handles the response to the QuickTestImageURL request. The method always
  3781  // closes the http.Response Body.
  3782  func (client BaseClient) QuickTestImageURLResponder(resp *http.Response) (result ImagePrediction, err error) {
  3783  	err = autorest.Respond(
  3784  		resp,
  3785  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3786  		autorest.ByUnmarshallingJSON(&result),
  3787  		autorest.ByClosing())
  3788  	result.Response = autorest.Response{Response: resp}
  3789  	return
  3790  }
  3791  
  3792  // SuggestTagsAndRegions this API will get suggested tags and regions for an array/batch of untagged images along with
  3793  // confidences for the tags. It returns an empty array if no tags are found.
  3794  // There is a limit of 64 images in the batch.
  3795  // Parameters:
  3796  // projectID - the project id.
  3797  // iterationID - iterationId to use for tag and region suggestion.
  3798  // imageIds - array of image ids tag suggestion are needed for. Use GetUntaggedImages API to get imageIds.
  3799  func (client BaseClient) SuggestTagsAndRegions(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, imageIds []uuid.UUID) (result ListSuggestedTagAndRegion, err error) {
  3800  	if tracing.IsEnabled() {
  3801  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SuggestTagsAndRegions")
  3802  		defer func() {
  3803  			sc := -1
  3804  			if result.Response.Response != nil {
  3805  				sc = result.Response.Response.StatusCode
  3806  			}
  3807  			tracing.EndSpan(ctx, sc, err)
  3808  		}()
  3809  	}
  3810  	if err := validation.Validate([]validation.Validation{
  3811  		{TargetValue: imageIds,
  3812  			Constraints: []validation.Constraint{{Target: "imageIds", Name: validation.Null, Rule: true,
  3813  				Chain: []validation.Constraint{{Target: "imageIds", Name: validation.MaxItems, Rule: 64, Chain: nil},
  3814  					{Target: "imageIds", Name: validation.MinItems, Rule: 0, Chain: nil},
  3815  				}}}}}); err != nil {
  3816  		return result, validation.NewError("training.BaseClient", "SuggestTagsAndRegions", err.Error())
  3817  	}
  3818  
  3819  	req, err := client.SuggestTagsAndRegionsPreparer(ctx, projectID, iterationID, imageIds)
  3820  	if err != nil {
  3821  		err = autorest.NewErrorWithError(err, "training.BaseClient", "SuggestTagsAndRegions", nil, "Failure preparing request")
  3822  		return
  3823  	}
  3824  
  3825  	resp, err := client.SuggestTagsAndRegionsSender(req)
  3826  	if err != nil {
  3827  		result.Response = autorest.Response{Response: resp}
  3828  		err = autorest.NewErrorWithError(err, "training.BaseClient", "SuggestTagsAndRegions", resp, "Failure sending request")
  3829  		return
  3830  	}
  3831  
  3832  	result, err = client.SuggestTagsAndRegionsResponder(resp)
  3833  	if err != nil {
  3834  		err = autorest.NewErrorWithError(err, "training.BaseClient", "SuggestTagsAndRegions", resp, "Failure responding to request")
  3835  		return
  3836  	}
  3837  
  3838  	return
  3839  }
  3840  
  3841  // SuggestTagsAndRegionsPreparer prepares the SuggestTagsAndRegions request.
  3842  func (client BaseClient) SuggestTagsAndRegionsPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, imageIds []uuid.UUID) (*http.Request, error) {
  3843  	urlParameters := map[string]interface{}{
  3844  		"Endpoint": client.Endpoint,
  3845  	}
  3846  
  3847  	pathParameters := map[string]interface{}{
  3848  		"projectId": autorest.Encode("path", projectID),
  3849  	}
  3850  
  3851  	queryParameters := map[string]interface{}{
  3852  		"imageIds":    autorest.Encode("query", imageIds, ","),
  3853  		"iterationId": autorest.Encode("query", iterationID),
  3854  	}
  3855  
  3856  	preparer := autorest.CreatePreparer(
  3857  		autorest.AsPost(),
  3858  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3859  		autorest.WithPathParameters("/projects/{projectId}/tagsandregions/suggestions", pathParameters),
  3860  		autorest.WithQueryParameters(queryParameters))
  3861  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3862  }
  3863  
  3864  // SuggestTagsAndRegionsSender sends the SuggestTagsAndRegions request. The method will close the
  3865  // http.Response Body if it receives an error.
  3866  func (client BaseClient) SuggestTagsAndRegionsSender(req *http.Request) (*http.Response, error) {
  3867  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3868  }
  3869  
  3870  // SuggestTagsAndRegionsResponder handles the response to the SuggestTagsAndRegions request. The method always
  3871  // closes the http.Response Body.
  3872  func (client BaseClient) SuggestTagsAndRegionsResponder(resp *http.Response) (result ListSuggestedTagAndRegion, err error) {
  3873  	err = autorest.Respond(
  3874  		resp,
  3875  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3876  		autorest.ByUnmarshallingJSON(&result.Value),
  3877  		autorest.ByClosing())
  3878  	result.Response = autorest.Response{Response: resp}
  3879  	return
  3880  }
  3881  
  3882  // TrainProject sends the train project request.
  3883  // Parameters:
  3884  // projectID - the project id.
  3885  // trainingType - the type of training to use to train the project (default: Regular).
  3886  // reservedBudgetInHours - the number of hours reserved as budget for training (if applicable).
  3887  // forceTrain - whether to force train even if dataset and configuration does not change (default: false).
  3888  // notificationEmailAddress - the email address to send notification to when training finishes (default: null).
  3889  // trainingParameters - additional training parameters passed in to control how the project is trained.
  3890  func (client BaseClient) TrainProject(ctx context.Context, projectID uuid.UUID, trainingType string, reservedBudgetInHours *int32, forceTrain *bool, notificationEmailAddress string, trainingParameters *Parameters) (result Iteration, err error) {
  3891  	if tracing.IsEnabled() {
  3892  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.TrainProject")
  3893  		defer func() {
  3894  			sc := -1
  3895  			if result.Response.Response != nil {
  3896  				sc = result.Response.Response.StatusCode
  3897  			}
  3898  			tracing.EndSpan(ctx, sc, err)
  3899  		}()
  3900  	}
  3901  	if err := validation.Validate([]validation.Validation{
  3902  		{TargetValue: trainingParameters,
  3903  			Constraints: []validation.Constraint{{Target: "trainingParameters", Name: validation.Null, Rule: false,
  3904  				Chain: []validation.Constraint{{Target: "trainingParameters.CustomBaseModelInfo", Name: validation.Null, Rule: false,
  3905  					Chain: []validation.Constraint{{Target: "trainingParameters.CustomBaseModelInfo.ProjectID", Name: validation.Null, Rule: true, Chain: nil},
  3906  						{Target: "trainingParameters.CustomBaseModelInfo.IterationID", Name: validation.Null, Rule: true, Chain: nil},
  3907  					}},
  3908  				}}}}}); err != nil {
  3909  		return result, validation.NewError("training.BaseClient", "TrainProject", err.Error())
  3910  	}
  3911  
  3912  	req, err := client.TrainProjectPreparer(ctx, projectID, trainingType, reservedBudgetInHours, forceTrain, notificationEmailAddress, trainingParameters)
  3913  	if err != nil {
  3914  		err = autorest.NewErrorWithError(err, "training.BaseClient", "TrainProject", nil, "Failure preparing request")
  3915  		return
  3916  	}
  3917  
  3918  	resp, err := client.TrainProjectSender(req)
  3919  	if err != nil {
  3920  		result.Response = autorest.Response{Response: resp}
  3921  		err = autorest.NewErrorWithError(err, "training.BaseClient", "TrainProject", resp, "Failure sending request")
  3922  		return
  3923  	}
  3924  
  3925  	result, err = client.TrainProjectResponder(resp)
  3926  	if err != nil {
  3927  		err = autorest.NewErrorWithError(err, "training.BaseClient", "TrainProject", resp, "Failure responding to request")
  3928  		return
  3929  	}
  3930  
  3931  	return
  3932  }
  3933  
  3934  // TrainProjectPreparer prepares the TrainProject request.
  3935  func (client BaseClient) TrainProjectPreparer(ctx context.Context, projectID uuid.UUID, trainingType string, reservedBudgetInHours *int32, forceTrain *bool, notificationEmailAddress string, trainingParameters *Parameters) (*http.Request, error) {
  3936  	urlParameters := map[string]interface{}{
  3937  		"Endpoint": client.Endpoint,
  3938  	}
  3939  
  3940  	pathParameters := map[string]interface{}{
  3941  		"projectId": autorest.Encode("path", projectID),
  3942  	}
  3943  
  3944  	queryParameters := map[string]interface{}{}
  3945  	if len(string(trainingType)) > 0 {
  3946  		queryParameters["trainingType"] = autorest.Encode("query", trainingType)
  3947  	}
  3948  	if reservedBudgetInHours != nil {
  3949  		queryParameters["reservedBudgetInHours"] = autorest.Encode("query", *reservedBudgetInHours)
  3950  	} else {
  3951  		queryParameters["reservedBudgetInHours"] = autorest.Encode("query", 0)
  3952  	}
  3953  	if forceTrain != nil {
  3954  		queryParameters["forceTrain"] = autorest.Encode("query", *forceTrain)
  3955  	} else {
  3956  		queryParameters["forceTrain"] = autorest.Encode("query", false)
  3957  	}
  3958  	if len(notificationEmailAddress) > 0 {
  3959  		queryParameters["notificationEmailAddress"] = autorest.Encode("query", notificationEmailAddress)
  3960  	}
  3961  
  3962  	preparer := autorest.CreatePreparer(
  3963  		autorest.AsContentType("application/json; charset=utf-8"),
  3964  		autorest.AsPost(),
  3965  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  3966  		autorest.WithPathParameters("/projects/{projectId}/train", pathParameters),
  3967  		autorest.WithQueryParameters(queryParameters))
  3968  	if trainingParameters != nil {
  3969  		preparer = autorest.DecoratePreparer(preparer,
  3970  			autorest.WithJSON(trainingParameters))
  3971  	}
  3972  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  3973  }
  3974  
  3975  // TrainProjectSender sends the TrainProject request. The method will close the
  3976  // http.Response Body if it receives an error.
  3977  func (client BaseClient) TrainProjectSender(req *http.Request) (*http.Response, error) {
  3978  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  3979  }
  3980  
  3981  // TrainProjectResponder handles the response to the TrainProject request. The method always
  3982  // closes the http.Response Body.
  3983  func (client BaseClient) TrainProjectResponder(resp *http.Response) (result Iteration, err error) {
  3984  	err = autorest.Respond(
  3985  		resp,
  3986  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  3987  		autorest.ByUnmarshallingJSON(&result),
  3988  		autorest.ByClosing())
  3989  	result.Response = autorest.Response{Response: resp}
  3990  	return
  3991  }
  3992  
  3993  // UnpublishIteration sends the unpublish iteration request.
  3994  // Parameters:
  3995  // projectID - the project id.
  3996  // iterationID - the iteration id.
  3997  func (client BaseClient) UnpublishIteration(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID) (result autorest.Response, err error) {
  3998  	if tracing.IsEnabled() {
  3999  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UnpublishIteration")
  4000  		defer func() {
  4001  			sc := -1
  4002  			if result.Response != nil {
  4003  				sc = result.Response.StatusCode
  4004  			}
  4005  			tracing.EndSpan(ctx, sc, err)
  4006  		}()
  4007  	}
  4008  	req, err := client.UnpublishIterationPreparer(ctx, projectID, iterationID)
  4009  	if err != nil {
  4010  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UnpublishIteration", nil, "Failure preparing request")
  4011  		return
  4012  	}
  4013  
  4014  	resp, err := client.UnpublishIterationSender(req)
  4015  	if err != nil {
  4016  		result.Response = resp
  4017  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UnpublishIteration", resp, "Failure sending request")
  4018  		return
  4019  	}
  4020  
  4021  	result, err = client.UnpublishIterationResponder(resp)
  4022  	if err != nil {
  4023  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UnpublishIteration", resp, "Failure responding to request")
  4024  		return
  4025  	}
  4026  
  4027  	return
  4028  }
  4029  
  4030  // UnpublishIterationPreparer prepares the UnpublishIteration request.
  4031  func (client BaseClient) UnpublishIterationPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID) (*http.Request, error) {
  4032  	urlParameters := map[string]interface{}{
  4033  		"Endpoint": client.Endpoint,
  4034  	}
  4035  
  4036  	pathParameters := map[string]interface{}{
  4037  		"iterationId": autorest.Encode("path", iterationID),
  4038  		"projectId":   autorest.Encode("path", projectID),
  4039  	}
  4040  
  4041  	preparer := autorest.CreatePreparer(
  4042  		autorest.AsDelete(),
  4043  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  4044  		autorest.WithPathParameters("/projects/{projectId}/iterations/{iterationId}/publish", pathParameters))
  4045  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  4046  }
  4047  
  4048  // UnpublishIterationSender sends the UnpublishIteration request. The method will close the
  4049  // http.Response Body if it receives an error.
  4050  func (client BaseClient) UnpublishIterationSender(req *http.Request) (*http.Response, error) {
  4051  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  4052  }
  4053  
  4054  // UnpublishIterationResponder handles the response to the UnpublishIteration request. The method always
  4055  // closes the http.Response Body.
  4056  func (client BaseClient) UnpublishIterationResponder(resp *http.Response) (result autorest.Response, err error) {
  4057  	err = autorest.Respond(
  4058  		resp,
  4059  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
  4060  		autorest.ByClosing())
  4061  	result.Response = resp
  4062  	return
  4063  }
  4064  
  4065  // UpdateImageMetadata this API accepts a batch of image Ids, and metadata, to update images. There is a limit of 64
  4066  // images.
  4067  // Parameters:
  4068  // projectID - the project id.
  4069  // imageIds - the list of image ids to update. Limited to 64.
  4070  // metadata - the metadata to be updated to the specified images. Limited to 10 key-value pairs per image. The
  4071  // length of key is limited to 128. The length of value is limited to 256.
  4072  func (client BaseClient) UpdateImageMetadata(ctx context.Context, projectID uuid.UUID, imageIds []uuid.UUID, metadata map[string]*string) (result ImageMetadataUpdateSummary, err error) {
  4073  	if tracing.IsEnabled() {
  4074  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateImageMetadata")
  4075  		defer func() {
  4076  			sc := -1
  4077  			if result.Response.Response != nil {
  4078  				sc = result.Response.Response.StatusCode
  4079  			}
  4080  			tracing.EndSpan(ctx, sc, err)
  4081  		}()
  4082  	}
  4083  	if err := validation.Validate([]validation.Validation{
  4084  		{TargetValue: imageIds,
  4085  			Constraints: []validation.Constraint{{Target: "imageIds", Name: validation.Null, Rule: true,
  4086  				Chain: []validation.Constraint{{Target: "imageIds", Name: validation.MaxItems, Rule: 256, Chain: nil},
  4087  					{Target: "imageIds", Name: validation.MinItems, Rule: 0, Chain: nil},
  4088  				}}}},
  4089  		{TargetValue: metadata,
  4090  			Constraints: []validation.Constraint{{Target: "metadata", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
  4091  		return result, validation.NewError("training.BaseClient", "UpdateImageMetadata", err.Error())
  4092  	}
  4093  
  4094  	req, err := client.UpdateImageMetadataPreparer(ctx, projectID, imageIds, metadata)
  4095  	if err != nil {
  4096  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateImageMetadata", nil, "Failure preparing request")
  4097  		return
  4098  	}
  4099  
  4100  	resp, err := client.UpdateImageMetadataSender(req)
  4101  	if err != nil {
  4102  		result.Response = autorest.Response{Response: resp}
  4103  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateImageMetadata", resp, "Failure sending request")
  4104  		return
  4105  	}
  4106  
  4107  	result, err = client.UpdateImageMetadataResponder(resp)
  4108  	if err != nil {
  4109  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateImageMetadata", resp, "Failure responding to request")
  4110  		return
  4111  	}
  4112  
  4113  	return
  4114  }
  4115  
  4116  // UpdateImageMetadataPreparer prepares the UpdateImageMetadata request.
  4117  func (client BaseClient) UpdateImageMetadataPreparer(ctx context.Context, projectID uuid.UUID, imageIds []uuid.UUID, metadata map[string]*string) (*http.Request, error) {
  4118  	urlParameters := map[string]interface{}{
  4119  		"Endpoint": client.Endpoint,
  4120  	}
  4121  
  4122  	pathParameters := map[string]interface{}{
  4123  		"projectId": autorest.Encode("path", projectID),
  4124  	}
  4125  
  4126  	queryParameters := map[string]interface{}{
  4127  		"imageIds": autorest.Encode("query", imageIds, ","),
  4128  	}
  4129  
  4130  	preparer := autorest.CreatePreparer(
  4131  		autorest.AsContentType("application/json; charset=utf-8"),
  4132  		autorest.AsPost(),
  4133  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  4134  		autorest.WithPathParameters("/projects/{projectId}/images/metadata", pathParameters),
  4135  		autorest.WithJSON(metadata),
  4136  		autorest.WithQueryParameters(queryParameters))
  4137  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  4138  }
  4139  
  4140  // UpdateImageMetadataSender sends the UpdateImageMetadata request. The method will close the
  4141  // http.Response Body if it receives an error.
  4142  func (client BaseClient) UpdateImageMetadataSender(req *http.Request) (*http.Response, error) {
  4143  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  4144  }
  4145  
  4146  // UpdateImageMetadataResponder handles the response to the UpdateImageMetadata request. The method always
  4147  // closes the http.Response Body.
  4148  func (client BaseClient) UpdateImageMetadataResponder(resp *http.Response) (result ImageMetadataUpdateSummary, err error) {
  4149  	err = autorest.Respond(
  4150  		resp,
  4151  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusMultiStatus),
  4152  		autorest.ByUnmarshallingJSON(&result),
  4153  		autorest.ByClosing())
  4154  	result.Response = autorest.Response{Response: resp}
  4155  	return
  4156  }
  4157  
  4158  // UpdateIteration sends the update iteration request.
  4159  // Parameters:
  4160  // projectID - project id.
  4161  // iterationID - iteration id.
  4162  // updatedIteration - the updated iteration model.
  4163  func (client BaseClient) UpdateIteration(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, updatedIteration Iteration) (result Iteration, err error) {
  4164  	if tracing.IsEnabled() {
  4165  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateIteration")
  4166  		defer func() {
  4167  			sc := -1
  4168  			if result.Response.Response != nil {
  4169  				sc = result.Response.Response.StatusCode
  4170  			}
  4171  			tracing.EndSpan(ctx, sc, err)
  4172  		}()
  4173  	}
  4174  	req, err := client.UpdateIterationPreparer(ctx, projectID, iterationID, updatedIteration)
  4175  	if err != nil {
  4176  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateIteration", nil, "Failure preparing request")
  4177  		return
  4178  	}
  4179  
  4180  	resp, err := client.UpdateIterationSender(req)
  4181  	if err != nil {
  4182  		result.Response = autorest.Response{Response: resp}
  4183  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateIteration", resp, "Failure sending request")
  4184  		return
  4185  	}
  4186  
  4187  	result, err = client.UpdateIterationResponder(resp)
  4188  	if err != nil {
  4189  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateIteration", resp, "Failure responding to request")
  4190  		return
  4191  	}
  4192  
  4193  	return
  4194  }
  4195  
  4196  // UpdateIterationPreparer prepares the UpdateIteration request.
  4197  func (client BaseClient) UpdateIterationPreparer(ctx context.Context, projectID uuid.UUID, iterationID uuid.UUID, updatedIteration Iteration) (*http.Request, error) {
  4198  	urlParameters := map[string]interface{}{
  4199  		"Endpoint": client.Endpoint,
  4200  	}
  4201  
  4202  	pathParameters := map[string]interface{}{
  4203  		"iterationId": autorest.Encode("path", iterationID),
  4204  		"projectId":   autorest.Encode("path", projectID),
  4205  	}
  4206  
  4207  	updatedIteration.ID = nil
  4208  	updatedIteration.Status = nil
  4209  	updatedIteration.Created = nil
  4210  	updatedIteration.LastModified = nil
  4211  	updatedIteration.TrainedAt = nil
  4212  	updatedIteration.ProjectID = nil
  4213  	updatedIteration.Exportable = nil
  4214  	updatedIteration.ExportableTo = nil
  4215  	updatedIteration.DomainID = nil
  4216  	updatedIteration.ClassificationType = ""
  4217  	updatedIteration.TrainingType = ""
  4218  	updatedIteration.ReservedBudgetInHours = nil
  4219  	updatedIteration.TrainingTimeInMinutes = nil
  4220  	updatedIteration.PublishName = nil
  4221  	updatedIteration.OriginalPublishResourceID = nil
  4222  	updatedIteration.CustomBaseModelInfo = nil
  4223  	updatedIteration.TrainingErrorDetails = nil
  4224  	preparer := autorest.CreatePreparer(
  4225  		autorest.AsContentType("application/json; charset=utf-8"),
  4226  		autorest.AsPatch(),
  4227  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  4228  		autorest.WithPathParameters("/projects/{projectId}/iterations/{iterationId}", pathParameters),
  4229  		autorest.WithJSON(updatedIteration))
  4230  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  4231  }
  4232  
  4233  // UpdateIterationSender sends the UpdateIteration request. The method will close the
  4234  // http.Response Body if it receives an error.
  4235  func (client BaseClient) UpdateIterationSender(req *http.Request) (*http.Response, error) {
  4236  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  4237  }
  4238  
  4239  // UpdateIterationResponder handles the response to the UpdateIteration request. The method always
  4240  // closes the http.Response Body.
  4241  func (client BaseClient) UpdateIterationResponder(resp *http.Response) (result Iteration, err error) {
  4242  	err = autorest.Respond(
  4243  		resp,
  4244  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  4245  		autorest.ByUnmarshallingJSON(&result),
  4246  		autorest.ByClosing())
  4247  	result.Response = autorest.Response{Response: resp}
  4248  	return
  4249  }
  4250  
  4251  // UpdateProject sends the update project request.
  4252  // Parameters:
  4253  // projectID - the id of the project to update.
  4254  // updatedProject - the updated project model.
  4255  func (client BaseClient) UpdateProject(ctx context.Context, projectID uuid.UUID, updatedProject Project) (result Project, err error) {
  4256  	if tracing.IsEnabled() {
  4257  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateProject")
  4258  		defer func() {
  4259  			sc := -1
  4260  			if result.Response.Response != nil {
  4261  				sc = result.Response.Response.StatusCode
  4262  			}
  4263  			tracing.EndSpan(ctx, sc, err)
  4264  		}()
  4265  	}
  4266  	req, err := client.UpdateProjectPreparer(ctx, projectID, updatedProject)
  4267  	if err != nil {
  4268  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateProject", nil, "Failure preparing request")
  4269  		return
  4270  	}
  4271  
  4272  	resp, err := client.UpdateProjectSender(req)
  4273  	if err != nil {
  4274  		result.Response = autorest.Response{Response: resp}
  4275  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateProject", resp, "Failure sending request")
  4276  		return
  4277  	}
  4278  
  4279  	result, err = client.UpdateProjectResponder(resp)
  4280  	if err != nil {
  4281  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateProject", resp, "Failure responding to request")
  4282  		return
  4283  	}
  4284  
  4285  	return
  4286  }
  4287  
  4288  // UpdateProjectPreparer prepares the UpdateProject request.
  4289  func (client BaseClient) UpdateProjectPreparer(ctx context.Context, projectID uuid.UUID, updatedProject Project) (*http.Request, error) {
  4290  	urlParameters := map[string]interface{}{
  4291  		"Endpoint": client.Endpoint,
  4292  	}
  4293  
  4294  	pathParameters := map[string]interface{}{
  4295  		"projectId": autorest.Encode("path", projectID),
  4296  	}
  4297  
  4298  	updatedProject.ID = nil
  4299  	updatedProject.Created = nil
  4300  	updatedProject.LastModified = nil
  4301  	updatedProject.ThumbnailURI = nil
  4302  	updatedProject.DrModeEnabled = nil
  4303  	preparer := autorest.CreatePreparer(
  4304  		autorest.AsContentType("application/json; charset=utf-8"),
  4305  		autorest.AsPatch(),
  4306  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  4307  		autorest.WithPathParameters("/projects/{projectId}", pathParameters),
  4308  		autorest.WithJSON(updatedProject))
  4309  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  4310  }
  4311  
  4312  // UpdateProjectSender sends the UpdateProject request. The method will close the
  4313  // http.Response Body if it receives an error.
  4314  func (client BaseClient) UpdateProjectSender(req *http.Request) (*http.Response, error) {
  4315  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  4316  }
  4317  
  4318  // UpdateProjectResponder handles the response to the UpdateProject request. The method always
  4319  // closes the http.Response Body.
  4320  func (client BaseClient) UpdateProjectResponder(resp *http.Response) (result Project, err error) {
  4321  	err = autorest.Respond(
  4322  		resp,
  4323  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  4324  		autorest.ByUnmarshallingJSON(&result),
  4325  		autorest.ByClosing())
  4326  	result.Response = autorest.Response{Response: resp}
  4327  	return
  4328  }
  4329  
  4330  // UpdateTag sends the update tag request.
  4331  // Parameters:
  4332  // projectID - the project id.
  4333  // tagID - the id of the target tag.
  4334  // updatedTag - the updated tag model.
  4335  func (client BaseClient) UpdateTag(ctx context.Context, projectID uuid.UUID, tagID uuid.UUID, updatedTag Tag) (result Tag, err error) {
  4336  	if tracing.IsEnabled() {
  4337  		ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateTag")
  4338  		defer func() {
  4339  			sc := -1
  4340  			if result.Response.Response != nil {
  4341  				sc = result.Response.Response.StatusCode
  4342  			}
  4343  			tracing.EndSpan(ctx, sc, err)
  4344  		}()
  4345  	}
  4346  	req, err := client.UpdateTagPreparer(ctx, projectID, tagID, updatedTag)
  4347  	if err != nil {
  4348  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateTag", nil, "Failure preparing request")
  4349  		return
  4350  	}
  4351  
  4352  	resp, err := client.UpdateTagSender(req)
  4353  	if err != nil {
  4354  		result.Response = autorest.Response{Response: resp}
  4355  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateTag", resp, "Failure sending request")
  4356  		return
  4357  	}
  4358  
  4359  	result, err = client.UpdateTagResponder(resp)
  4360  	if err != nil {
  4361  		err = autorest.NewErrorWithError(err, "training.BaseClient", "UpdateTag", resp, "Failure responding to request")
  4362  		return
  4363  	}
  4364  
  4365  	return
  4366  }
  4367  
  4368  // UpdateTagPreparer prepares the UpdateTag request.
  4369  func (client BaseClient) UpdateTagPreparer(ctx context.Context, projectID uuid.UUID, tagID uuid.UUID, updatedTag Tag) (*http.Request, error) {
  4370  	urlParameters := map[string]interface{}{
  4371  		"Endpoint": client.Endpoint,
  4372  	}
  4373  
  4374  	pathParameters := map[string]interface{}{
  4375  		"projectId": autorest.Encode("path", projectID),
  4376  		"tagId":     autorest.Encode("path", tagID),
  4377  	}
  4378  
  4379  	updatedTag.ID = nil
  4380  	updatedTag.ImageCount = nil
  4381  	preparer := autorest.CreatePreparer(
  4382  		autorest.AsContentType("application/json; charset=utf-8"),
  4383  		autorest.AsPatch(),
  4384  		autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.4-preview/training", urlParameters),
  4385  		autorest.WithPathParameters("/projects/{projectId}/tags/{tagId}", pathParameters),
  4386  		autorest.WithJSON(updatedTag))
  4387  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  4388  }
  4389  
  4390  // UpdateTagSender sends the UpdateTag request. The method will close the
  4391  // http.Response Body if it receives an error.
  4392  func (client BaseClient) UpdateTagSender(req *http.Request) (*http.Response, error) {
  4393  	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
  4394  }
  4395  
  4396  // UpdateTagResponder handles the response to the UpdateTag request. The method always
  4397  // closes the http.Response Body.
  4398  func (client BaseClient) UpdateTagResponder(resp *http.Response) (result Tag, err error) {
  4399  	err = autorest.Respond(
  4400  		resp,
  4401  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  4402  		autorest.ByUnmarshallingJSON(&result),
  4403  		autorest.ByClosing())
  4404  	result.Response = autorest.Response{Response: resp}
  4405  	return
  4406  }
  4407  

View as plain text