...

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

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

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

View as plain text