From 4f40c70f6300e7f4554f9688a9142acf40d61a9f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 22 Mar 2019 10:03:43 -0700 Subject: [PATCH] Generated from b4c474eb63aa5d6ff1d89c0528e0b02a38e94aa6 (#4361) enable release_3_0 for Go SDK --- .../customvision/prediction/models.go | 123 ++- .../prediction/predictionapi/models.go | 2 +- .../customvision/prediction/models.go | 123 ++- .../prediction/predictionapi/models.go | 2 +- .../v3.0/customvision/prediction/client.go | 769 ++++++++++++++++++ .../v3.0/customvision/prediction/models.go | 315 +++++++ .../prediction/predictionapi/interfaces.go | 39 + .../v3.0/customvision/prediction/version.go | 30 + 8 files changed, 1399 insertions(+), 4 deletions(-) create mode 100644 services/cognitiveservices/v3.0/customvision/prediction/client.go create mode 100644 services/cognitiveservices/v3.0/customvision/prediction/models.go create mode 100644 services/cognitiveservices/v3.0/customvision/prediction/predictionapi/interfaces.go create mode 100644 services/cognitiveservices/v3.0/customvision/prediction/version.go diff --git a/profiles/latest/cognitiveservices/customvision/prediction/models.go b/profiles/latest/cognitiveservices/customvision/prediction/models.go index 683de6b85833..546fac43aac4 100644 --- a/profiles/latest/cognitiveservices/customvision/prediction/models.go +++ b/profiles/latest/cognitiveservices/customvision/prediction/models.go @@ -19,10 +19,128 @@ package prediction -import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.1/customvision/prediction" +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v3.0/customvision/prediction" + +type CustomVisionErrorCodes = original.CustomVisionErrorCodes + +const ( + BadRequest CustomVisionErrorCodes = original.BadRequest + BadRequestCannotMigrateProjectWithName CustomVisionErrorCodes = original.BadRequestCannotMigrateProjectWithName + BadRequestClassificationTrainingValidationFailed CustomVisionErrorCodes = original.BadRequestClassificationTrainingValidationFailed + BadRequestDetectionTrainingNotAllowNegativeTag CustomVisionErrorCodes = original.BadRequestDetectionTrainingNotAllowNegativeTag + BadRequestDetectionTrainingValidationFailed CustomVisionErrorCodes = original.BadRequestDetectionTrainingValidationFailed + BadRequestDomainNotSupportedForAdvancedTraining CustomVisionErrorCodes = original.BadRequestDomainNotSupportedForAdvancedTraining + BadRequestExceededBatchSize CustomVisionErrorCodes = original.BadRequestExceededBatchSize + BadRequestExceededQuota CustomVisionErrorCodes = original.BadRequestExceededQuota + BadRequestExceedIterationPerProjectLimit CustomVisionErrorCodes = original.BadRequestExceedIterationPerProjectLimit + BadRequestExceedProjectLimit CustomVisionErrorCodes = original.BadRequestExceedProjectLimit + BadRequestExceedTagPerImageLimit CustomVisionErrorCodes = original.BadRequestExceedTagPerImageLimit + BadRequestExceedTagPerProjectLimit CustomVisionErrorCodes = original.BadRequestExceedTagPerProjectLimit + BadRequestExportAlreadyInProgress CustomVisionErrorCodes = original.BadRequestExportAlreadyInProgress + BadRequestExportPlatformNotSupportedForAdvancedTraining CustomVisionErrorCodes = original.BadRequestExportPlatformNotSupportedForAdvancedTraining + BadRequestExportValidationFailed CustomVisionErrorCodes = original.BadRequestExportValidationFailed + BadRequestImageBatch CustomVisionErrorCodes = original.BadRequestImageBatch + BadRequestImageExceededCount CustomVisionErrorCodes = original.BadRequestImageExceededCount + BadRequestImageFormat CustomVisionErrorCodes = original.BadRequestImageFormat + BadRequestImageRegions CustomVisionErrorCodes = original.BadRequestImageRegions + BadRequestImageSizeBytes CustomVisionErrorCodes = original.BadRequestImageSizeBytes + BadRequestImageStream CustomVisionErrorCodes = original.BadRequestImageStream + BadRequestImageTags CustomVisionErrorCodes = original.BadRequestImageTags + BadRequestImageURL CustomVisionErrorCodes = original.BadRequestImageURL + BadRequestInvalid CustomVisionErrorCodes = original.BadRequestInvalid + BadRequestInvalidEmailAddress CustomVisionErrorCodes = original.BadRequestInvalidEmailAddress + BadRequestInvalidIds CustomVisionErrorCodes = original.BadRequestInvalidIds + BadRequestInvalidPublishName CustomVisionErrorCodes = original.BadRequestInvalidPublishName + BadRequestInvalidPublishTarget CustomVisionErrorCodes = original.BadRequestInvalidPublishTarget + BadRequestIterationDescription CustomVisionErrorCodes = original.BadRequestIterationDescription + BadRequestIterationIsNotTrained CustomVisionErrorCodes = original.BadRequestIterationIsNotTrained + BadRequestIterationIsPublished CustomVisionErrorCodes = original.BadRequestIterationIsPublished + BadRequestIterationName CustomVisionErrorCodes = original.BadRequestIterationName + BadRequestIterationNameNotUnique CustomVisionErrorCodes = original.BadRequestIterationNameNotUnique + BadRequestMultiClassClassificationTrainingValidationFailed CustomVisionErrorCodes = original.BadRequestMultiClassClassificationTrainingValidationFailed + BadRequestMultiLabelClassificationTrainingValidationFailed CustomVisionErrorCodes = original.BadRequestMultiLabelClassificationTrainingValidationFailed + BadRequestMultipleNegativeTag CustomVisionErrorCodes = original.BadRequestMultipleNegativeTag + BadRequestNegativeAndRegularTagOnSameImage CustomVisionErrorCodes = original.BadRequestNegativeAndRegularTagOnSameImage + BadRequestNotLimitedTrial CustomVisionErrorCodes = original.BadRequestNotLimitedTrial + BadRequestNotSupported CustomVisionErrorCodes = original.BadRequestNotSupported + BadRequestPredictionIdsExceededCount CustomVisionErrorCodes = original.BadRequestPredictionIdsExceededCount + BadRequestPredictionIdsMissing CustomVisionErrorCodes = original.BadRequestPredictionIdsMissing + BadRequestPredictionInvalidApplicationName CustomVisionErrorCodes = original.BadRequestPredictionInvalidApplicationName + BadRequestPredictionInvalidQueryParameters CustomVisionErrorCodes = original.BadRequestPredictionInvalidQueryParameters + BadRequestPredictionResultsExceededCount CustomVisionErrorCodes = original.BadRequestPredictionResultsExceededCount + BadRequestPredictionTagsExceededCount CustomVisionErrorCodes = original.BadRequestPredictionTagsExceededCount + BadRequestProjectDescription CustomVisionErrorCodes = original.BadRequestProjectDescription + BadRequestProjectName CustomVisionErrorCodes = original.BadRequestProjectName + BadRequestProjectNameNotUnique CustomVisionErrorCodes = original.BadRequestProjectNameNotUnique + BadRequestProjectUnknownClassification CustomVisionErrorCodes = original.BadRequestProjectUnknownClassification + BadRequestProjectUnknownDomain CustomVisionErrorCodes = original.BadRequestProjectUnknownDomain + BadRequestProjectUnsupportedDomainTypeChange CustomVisionErrorCodes = original.BadRequestProjectUnsupportedDomainTypeChange + BadRequestProjectUnsupportedExportPlatform CustomVisionErrorCodes = original.BadRequestProjectUnsupportedExportPlatform + BadRequestRequiredParamIsNull CustomVisionErrorCodes = original.BadRequestRequiredParamIsNull + BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining CustomVisionErrorCodes = original.BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining + BadRequestSubscriptionAPI CustomVisionErrorCodes = original.BadRequestSubscriptionAPI + BadRequestTagDescription CustomVisionErrorCodes = original.BadRequestTagDescription + BadRequestTagName CustomVisionErrorCodes = original.BadRequestTagName + BadRequestTagNameNotUnique CustomVisionErrorCodes = original.BadRequestTagNameNotUnique + BadRequestTagType CustomVisionErrorCodes = original.BadRequestTagType + BadRequestTrainingAlreadyInProgress CustomVisionErrorCodes = original.BadRequestTrainingAlreadyInProgress + BadRequestTrainingNotNeeded CustomVisionErrorCodes = original.BadRequestTrainingNotNeeded + BadRequestTrainingNotNeededButTrainingPipelineUpdated CustomVisionErrorCodes = original.BadRequestTrainingNotNeededButTrainingPipelineUpdated + BadRequestTrainingValidationFailed CustomVisionErrorCodes = original.BadRequestTrainingValidationFailed + BadRequestUnpublishFailed CustomVisionErrorCodes = original.BadRequestUnpublishFailed + BadRequestWorkspaceCannotBeModified CustomVisionErrorCodes = original.BadRequestWorkspaceCannotBeModified + BadRequestWorkspaceNotDeletable CustomVisionErrorCodes = original.BadRequestWorkspaceNotDeletable + Conflict CustomVisionErrorCodes = original.Conflict + ConflictInvalid CustomVisionErrorCodes = original.ConflictInvalid + ErrorExporterInvalidClassifier CustomVisionErrorCodes = original.ErrorExporterInvalidClassifier + ErrorExporterInvalidFeaturizer CustomVisionErrorCodes = original.ErrorExporterInvalidFeaturizer + ErrorExporterInvalidPlatform CustomVisionErrorCodes = original.ErrorExporterInvalidPlatform + ErrorFeaturizationAugmentationError CustomVisionErrorCodes = original.ErrorFeaturizationAugmentationError + ErrorFeaturizationAugmentationUnavailable CustomVisionErrorCodes = original.ErrorFeaturizationAugmentationUnavailable + ErrorFeaturizationInvalidFeaturizer CustomVisionErrorCodes = original.ErrorFeaturizationInvalidFeaturizer + ErrorFeaturizationQueueTimeout CustomVisionErrorCodes = original.ErrorFeaturizationQueueTimeout + ErrorFeaturizationServiceUnavailable CustomVisionErrorCodes = original.ErrorFeaturizationServiceUnavailable + ErrorFeaturizationUnrecognizedJob CustomVisionErrorCodes = original.ErrorFeaturizationUnrecognizedJob + ErrorInvalid CustomVisionErrorCodes = original.ErrorInvalid + ErrorPrediction CustomVisionErrorCodes = original.ErrorPrediction + ErrorPredictionModelNotCached CustomVisionErrorCodes = original.ErrorPredictionModelNotCached + ErrorPredictionModelNotFound CustomVisionErrorCodes = original.ErrorPredictionModelNotFound + ErrorPredictionServiceUnavailable CustomVisionErrorCodes = original.ErrorPredictionServiceUnavailable + ErrorPredictionStorage CustomVisionErrorCodes = original.ErrorPredictionStorage + ErrorProjectExportRequestFailed CustomVisionErrorCodes = original.ErrorProjectExportRequestFailed + ErrorProjectInvalidDomain CustomVisionErrorCodes = original.ErrorProjectInvalidDomain + ErrorProjectInvalidPipelineConfiguration CustomVisionErrorCodes = original.ErrorProjectInvalidPipelineConfiguration + ErrorProjectInvalidWorkspace CustomVisionErrorCodes = original.ErrorProjectInvalidWorkspace + ErrorProjectTrainingRequestFailed CustomVisionErrorCodes = original.ErrorProjectTrainingRequestFailed + ErrorRegionProposal CustomVisionErrorCodes = original.ErrorRegionProposal + ErrorUnknown CustomVisionErrorCodes = original.ErrorUnknown + Forbidden CustomVisionErrorCodes = original.Forbidden + ForbiddenDRModeEnabled CustomVisionErrorCodes = original.ForbiddenDRModeEnabled + ForbiddenInvalid CustomVisionErrorCodes = original.ForbiddenInvalid + ForbiddenUser CustomVisionErrorCodes = original.ForbiddenUser + ForbiddenUserDisabled CustomVisionErrorCodes = original.ForbiddenUserDisabled + ForbiddenUserDoesNotExist CustomVisionErrorCodes = original.ForbiddenUserDoesNotExist + ForbiddenUserInsufficientCapability CustomVisionErrorCodes = original.ForbiddenUserInsufficientCapability + ForbiddenUserResource CustomVisionErrorCodes = original.ForbiddenUserResource + ForbiddenUserSignupAllowanceExceeded CustomVisionErrorCodes = original.ForbiddenUserSignupAllowanceExceeded + ForbiddenUserSignupDisabled CustomVisionErrorCodes = original.ForbiddenUserSignupDisabled + NoError CustomVisionErrorCodes = original.NoError + NotFound CustomVisionErrorCodes = original.NotFound + NotFoundApimSubscription CustomVisionErrorCodes = original.NotFoundApimSubscription + NotFoundDomain CustomVisionErrorCodes = original.NotFoundDomain + NotFoundImage CustomVisionErrorCodes = original.NotFoundImage + NotFoundInvalid CustomVisionErrorCodes = original.NotFoundInvalid + NotFoundIteration CustomVisionErrorCodes = original.NotFoundIteration + NotFoundIterationPerformance CustomVisionErrorCodes = original.NotFoundIterationPerformance + NotFoundProject CustomVisionErrorCodes = original.NotFoundProject + NotFoundProjectDefaultIteration CustomVisionErrorCodes = original.NotFoundProjectDefaultIteration + NotFoundTag CustomVisionErrorCodes = original.NotFoundTag + UnsupportedMediaType CustomVisionErrorCodes = original.UnsupportedMediaType +) type BaseClient = original.BaseClient type BoundingBox = original.BoundingBox +type CustomVisionError = original.CustomVisionError type ImagePrediction = original.ImagePrediction type ImageURL = original.ImageURL type Model = original.Model @@ -33,6 +151,9 @@ func New(aPIKey string, endpoint string) BaseClient { func NewWithoutDefaults(aPIKey string, endpoint string) BaseClient { return original.NewWithoutDefaults(aPIKey, endpoint) } +func PossibleCustomVisionErrorCodesValues() []CustomVisionErrorCodes { + return original.PossibleCustomVisionErrorCodesValues() +} func UserAgent() string { return original.UserAgent() + " profiles/latest" } diff --git a/profiles/latest/cognitiveservices/customvision/prediction/predictionapi/models.go b/profiles/latest/cognitiveservices/customvision/prediction/predictionapi/models.go index 26c8eb145ea8..e907dc83224c 100644 --- a/profiles/latest/cognitiveservices/customvision/prediction/predictionapi/models.go +++ b/profiles/latest/cognitiveservices/customvision/prediction/predictionapi/models.go @@ -19,6 +19,6 @@ package predictionapi -import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.1/customvision/prediction/predictionapi" +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v3.0/customvision/prediction/predictionapi" type BaseClientAPI = original.BaseClientAPI diff --git a/profiles/preview/cognitiveservices/customvision/prediction/models.go b/profiles/preview/cognitiveservices/customvision/prediction/models.go index f4a167743fd2..2f2d555dc40e 100644 --- a/profiles/preview/cognitiveservices/customvision/prediction/models.go +++ b/profiles/preview/cognitiveservices/customvision/prediction/models.go @@ -19,10 +19,128 @@ package prediction -import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.1/customvision/prediction" +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v3.0/customvision/prediction" + +type CustomVisionErrorCodes = original.CustomVisionErrorCodes + +const ( + BadRequest CustomVisionErrorCodes = original.BadRequest + BadRequestCannotMigrateProjectWithName CustomVisionErrorCodes = original.BadRequestCannotMigrateProjectWithName + BadRequestClassificationTrainingValidationFailed CustomVisionErrorCodes = original.BadRequestClassificationTrainingValidationFailed + BadRequestDetectionTrainingNotAllowNegativeTag CustomVisionErrorCodes = original.BadRequestDetectionTrainingNotAllowNegativeTag + BadRequestDetectionTrainingValidationFailed CustomVisionErrorCodes = original.BadRequestDetectionTrainingValidationFailed + BadRequestDomainNotSupportedForAdvancedTraining CustomVisionErrorCodes = original.BadRequestDomainNotSupportedForAdvancedTraining + BadRequestExceededBatchSize CustomVisionErrorCodes = original.BadRequestExceededBatchSize + BadRequestExceededQuota CustomVisionErrorCodes = original.BadRequestExceededQuota + BadRequestExceedIterationPerProjectLimit CustomVisionErrorCodes = original.BadRequestExceedIterationPerProjectLimit + BadRequestExceedProjectLimit CustomVisionErrorCodes = original.BadRequestExceedProjectLimit + BadRequestExceedTagPerImageLimit CustomVisionErrorCodes = original.BadRequestExceedTagPerImageLimit + BadRequestExceedTagPerProjectLimit CustomVisionErrorCodes = original.BadRequestExceedTagPerProjectLimit + BadRequestExportAlreadyInProgress CustomVisionErrorCodes = original.BadRequestExportAlreadyInProgress + BadRequestExportPlatformNotSupportedForAdvancedTraining CustomVisionErrorCodes = original.BadRequestExportPlatformNotSupportedForAdvancedTraining + BadRequestExportValidationFailed CustomVisionErrorCodes = original.BadRequestExportValidationFailed + BadRequestImageBatch CustomVisionErrorCodes = original.BadRequestImageBatch + BadRequestImageExceededCount CustomVisionErrorCodes = original.BadRequestImageExceededCount + BadRequestImageFormat CustomVisionErrorCodes = original.BadRequestImageFormat + BadRequestImageRegions CustomVisionErrorCodes = original.BadRequestImageRegions + BadRequestImageSizeBytes CustomVisionErrorCodes = original.BadRequestImageSizeBytes + BadRequestImageStream CustomVisionErrorCodes = original.BadRequestImageStream + BadRequestImageTags CustomVisionErrorCodes = original.BadRequestImageTags + BadRequestImageURL CustomVisionErrorCodes = original.BadRequestImageURL + BadRequestInvalid CustomVisionErrorCodes = original.BadRequestInvalid + BadRequestInvalidEmailAddress CustomVisionErrorCodes = original.BadRequestInvalidEmailAddress + BadRequestInvalidIds CustomVisionErrorCodes = original.BadRequestInvalidIds + BadRequestInvalidPublishName CustomVisionErrorCodes = original.BadRequestInvalidPublishName + BadRequestInvalidPublishTarget CustomVisionErrorCodes = original.BadRequestInvalidPublishTarget + BadRequestIterationDescription CustomVisionErrorCodes = original.BadRequestIterationDescription + BadRequestIterationIsNotTrained CustomVisionErrorCodes = original.BadRequestIterationIsNotTrained + BadRequestIterationIsPublished CustomVisionErrorCodes = original.BadRequestIterationIsPublished + BadRequestIterationName CustomVisionErrorCodes = original.BadRequestIterationName + BadRequestIterationNameNotUnique CustomVisionErrorCodes = original.BadRequestIterationNameNotUnique + BadRequestMultiClassClassificationTrainingValidationFailed CustomVisionErrorCodes = original.BadRequestMultiClassClassificationTrainingValidationFailed + BadRequestMultiLabelClassificationTrainingValidationFailed CustomVisionErrorCodes = original.BadRequestMultiLabelClassificationTrainingValidationFailed + BadRequestMultipleNegativeTag CustomVisionErrorCodes = original.BadRequestMultipleNegativeTag + BadRequestNegativeAndRegularTagOnSameImage CustomVisionErrorCodes = original.BadRequestNegativeAndRegularTagOnSameImage + BadRequestNotLimitedTrial CustomVisionErrorCodes = original.BadRequestNotLimitedTrial + BadRequestNotSupported CustomVisionErrorCodes = original.BadRequestNotSupported + BadRequestPredictionIdsExceededCount CustomVisionErrorCodes = original.BadRequestPredictionIdsExceededCount + BadRequestPredictionIdsMissing CustomVisionErrorCodes = original.BadRequestPredictionIdsMissing + BadRequestPredictionInvalidApplicationName CustomVisionErrorCodes = original.BadRequestPredictionInvalidApplicationName + BadRequestPredictionInvalidQueryParameters CustomVisionErrorCodes = original.BadRequestPredictionInvalidQueryParameters + BadRequestPredictionResultsExceededCount CustomVisionErrorCodes = original.BadRequestPredictionResultsExceededCount + BadRequestPredictionTagsExceededCount CustomVisionErrorCodes = original.BadRequestPredictionTagsExceededCount + BadRequestProjectDescription CustomVisionErrorCodes = original.BadRequestProjectDescription + BadRequestProjectName CustomVisionErrorCodes = original.BadRequestProjectName + BadRequestProjectNameNotUnique CustomVisionErrorCodes = original.BadRequestProjectNameNotUnique + BadRequestProjectUnknownClassification CustomVisionErrorCodes = original.BadRequestProjectUnknownClassification + BadRequestProjectUnknownDomain CustomVisionErrorCodes = original.BadRequestProjectUnknownDomain + BadRequestProjectUnsupportedDomainTypeChange CustomVisionErrorCodes = original.BadRequestProjectUnsupportedDomainTypeChange + BadRequestProjectUnsupportedExportPlatform CustomVisionErrorCodes = original.BadRequestProjectUnsupportedExportPlatform + BadRequestRequiredParamIsNull CustomVisionErrorCodes = original.BadRequestRequiredParamIsNull + BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining CustomVisionErrorCodes = original.BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining + BadRequestSubscriptionAPI CustomVisionErrorCodes = original.BadRequestSubscriptionAPI + BadRequestTagDescription CustomVisionErrorCodes = original.BadRequestTagDescription + BadRequestTagName CustomVisionErrorCodes = original.BadRequestTagName + BadRequestTagNameNotUnique CustomVisionErrorCodes = original.BadRequestTagNameNotUnique + BadRequestTagType CustomVisionErrorCodes = original.BadRequestTagType + BadRequestTrainingAlreadyInProgress CustomVisionErrorCodes = original.BadRequestTrainingAlreadyInProgress + BadRequestTrainingNotNeeded CustomVisionErrorCodes = original.BadRequestTrainingNotNeeded + BadRequestTrainingNotNeededButTrainingPipelineUpdated CustomVisionErrorCodes = original.BadRequestTrainingNotNeededButTrainingPipelineUpdated + BadRequestTrainingValidationFailed CustomVisionErrorCodes = original.BadRequestTrainingValidationFailed + BadRequestUnpublishFailed CustomVisionErrorCodes = original.BadRequestUnpublishFailed + BadRequestWorkspaceCannotBeModified CustomVisionErrorCodes = original.BadRequestWorkspaceCannotBeModified + BadRequestWorkspaceNotDeletable CustomVisionErrorCodes = original.BadRequestWorkspaceNotDeletable + Conflict CustomVisionErrorCodes = original.Conflict + ConflictInvalid CustomVisionErrorCodes = original.ConflictInvalid + ErrorExporterInvalidClassifier CustomVisionErrorCodes = original.ErrorExporterInvalidClassifier + ErrorExporterInvalidFeaturizer CustomVisionErrorCodes = original.ErrorExporterInvalidFeaturizer + ErrorExporterInvalidPlatform CustomVisionErrorCodes = original.ErrorExporterInvalidPlatform + ErrorFeaturizationAugmentationError CustomVisionErrorCodes = original.ErrorFeaturizationAugmentationError + ErrorFeaturizationAugmentationUnavailable CustomVisionErrorCodes = original.ErrorFeaturizationAugmentationUnavailable + ErrorFeaturizationInvalidFeaturizer CustomVisionErrorCodes = original.ErrorFeaturizationInvalidFeaturizer + ErrorFeaturizationQueueTimeout CustomVisionErrorCodes = original.ErrorFeaturizationQueueTimeout + ErrorFeaturizationServiceUnavailable CustomVisionErrorCodes = original.ErrorFeaturizationServiceUnavailable + ErrorFeaturizationUnrecognizedJob CustomVisionErrorCodes = original.ErrorFeaturizationUnrecognizedJob + ErrorInvalid CustomVisionErrorCodes = original.ErrorInvalid + ErrorPrediction CustomVisionErrorCodes = original.ErrorPrediction + ErrorPredictionModelNotCached CustomVisionErrorCodes = original.ErrorPredictionModelNotCached + ErrorPredictionModelNotFound CustomVisionErrorCodes = original.ErrorPredictionModelNotFound + ErrorPredictionServiceUnavailable CustomVisionErrorCodes = original.ErrorPredictionServiceUnavailable + ErrorPredictionStorage CustomVisionErrorCodes = original.ErrorPredictionStorage + ErrorProjectExportRequestFailed CustomVisionErrorCodes = original.ErrorProjectExportRequestFailed + ErrorProjectInvalidDomain CustomVisionErrorCodes = original.ErrorProjectInvalidDomain + ErrorProjectInvalidPipelineConfiguration CustomVisionErrorCodes = original.ErrorProjectInvalidPipelineConfiguration + ErrorProjectInvalidWorkspace CustomVisionErrorCodes = original.ErrorProjectInvalidWorkspace + ErrorProjectTrainingRequestFailed CustomVisionErrorCodes = original.ErrorProjectTrainingRequestFailed + ErrorRegionProposal CustomVisionErrorCodes = original.ErrorRegionProposal + ErrorUnknown CustomVisionErrorCodes = original.ErrorUnknown + Forbidden CustomVisionErrorCodes = original.Forbidden + ForbiddenDRModeEnabled CustomVisionErrorCodes = original.ForbiddenDRModeEnabled + ForbiddenInvalid CustomVisionErrorCodes = original.ForbiddenInvalid + ForbiddenUser CustomVisionErrorCodes = original.ForbiddenUser + ForbiddenUserDisabled CustomVisionErrorCodes = original.ForbiddenUserDisabled + ForbiddenUserDoesNotExist CustomVisionErrorCodes = original.ForbiddenUserDoesNotExist + ForbiddenUserInsufficientCapability CustomVisionErrorCodes = original.ForbiddenUserInsufficientCapability + ForbiddenUserResource CustomVisionErrorCodes = original.ForbiddenUserResource + ForbiddenUserSignupAllowanceExceeded CustomVisionErrorCodes = original.ForbiddenUserSignupAllowanceExceeded + ForbiddenUserSignupDisabled CustomVisionErrorCodes = original.ForbiddenUserSignupDisabled + NoError CustomVisionErrorCodes = original.NoError + NotFound CustomVisionErrorCodes = original.NotFound + NotFoundApimSubscription CustomVisionErrorCodes = original.NotFoundApimSubscription + NotFoundDomain CustomVisionErrorCodes = original.NotFoundDomain + NotFoundImage CustomVisionErrorCodes = original.NotFoundImage + NotFoundInvalid CustomVisionErrorCodes = original.NotFoundInvalid + NotFoundIteration CustomVisionErrorCodes = original.NotFoundIteration + NotFoundIterationPerformance CustomVisionErrorCodes = original.NotFoundIterationPerformance + NotFoundProject CustomVisionErrorCodes = original.NotFoundProject + NotFoundProjectDefaultIteration CustomVisionErrorCodes = original.NotFoundProjectDefaultIteration + NotFoundTag CustomVisionErrorCodes = original.NotFoundTag + UnsupportedMediaType CustomVisionErrorCodes = original.UnsupportedMediaType +) type BaseClient = original.BaseClient type BoundingBox = original.BoundingBox +type CustomVisionError = original.CustomVisionError type ImagePrediction = original.ImagePrediction type ImageURL = original.ImageURL type Model = original.Model @@ -33,6 +151,9 @@ func New(aPIKey string, endpoint string) BaseClient { func NewWithoutDefaults(aPIKey string, endpoint string) BaseClient { return original.NewWithoutDefaults(aPIKey, endpoint) } +func PossibleCustomVisionErrorCodesValues() []CustomVisionErrorCodes { + return original.PossibleCustomVisionErrorCodesValues() +} func UserAgent() string { return original.UserAgent() + " profiles/preview" } diff --git a/profiles/preview/cognitiveservices/customvision/prediction/predictionapi/models.go b/profiles/preview/cognitiveservices/customvision/prediction/predictionapi/models.go index 26c8eb145ea8..e907dc83224c 100644 --- a/profiles/preview/cognitiveservices/customvision/prediction/predictionapi/models.go +++ b/profiles/preview/cognitiveservices/customvision/prediction/predictionapi/models.go @@ -19,6 +19,6 @@ package predictionapi -import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.1/customvision/prediction/predictionapi" +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v3.0/customvision/prediction/predictionapi" type BaseClientAPI = original.BaseClientAPI diff --git a/services/cognitiveservices/v3.0/customvision/prediction/client.go b/services/cognitiveservices/v3.0/customvision/prediction/client.go new file mode 100644 index 000000000000..4383eedc75ec --- /dev/null +++ b/services/cognitiveservices/v3.0/customvision/prediction/client.go @@ -0,0 +1,769 @@ +// Package prediction implements the Azure ARM Prediction service API version 3.0. +// +// +package prediction + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/satori/go.uuid" + "io" + "net/http" +) + +// BaseClient is the base client for Prediction. +type BaseClient struct { + autorest.Client + APIKey string + Endpoint string +} + +// New creates an instance of the BaseClient client. +func New(aPIKey string, endpoint string) BaseClient { + return NewWithoutDefaults(aPIKey, endpoint) +} + +// NewWithoutDefaults creates an instance of the BaseClient client. +func NewWithoutDefaults(aPIKey string, endpoint string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + APIKey: aPIKey, + Endpoint: endpoint, + } +} + +// ClassifyImage sends the classify image request. +// Parameters: +// projectID - the project id. +// publishedName - specifies the name of the model to evaluate against. +// imageData - binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. +// application - optional. Specifies the name of application using the endpoint. +func (client BaseClient) ClassifyImage(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (result ImagePrediction, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ClassifyImage") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ClassifyImagePreparer(ctx, projectID, publishedName, imageData, application) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImage", nil, "Failure preparing request") + return + } + + resp, err := client.ClassifyImageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImage", resp, "Failure sending request") + return + } + + result, err = client.ClassifyImageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImage", resp, "Failure responding to request") + } + + return +} + +// ClassifyImagePreparer prepares the ClassifyImage request. +func (client BaseClient) ClassifyImagePreparer(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "projectId": autorest.Encode("path", projectID), + "publishedName": autorest.Encode("path", publishedName), + } + + queryParameters := map[string]interface{}{} + if len(application) > 0 { + queryParameters["application"] = autorest.Encode("query", application) + } + + formDataParameters := map[string]interface{}{ + "imageData": imageData, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.0/prediction", urlParameters), + autorest.WithPathParameters("/{projectId}/classify/iterations/{publishedName}/image", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithMultiPartFormData(formDataParameters), + autorest.WithHeader("Prediction-Key", client.APIKey)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ClassifyImageSender sends the ClassifyImage request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ClassifyImageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ClassifyImageResponder handles the response to the ClassifyImage request. The method always +// closes the http.Response Body. +func (client BaseClient) ClassifyImageResponder(resp *http.Response) (result ImagePrediction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ClassifyImageURL sends the classify image url request. +// Parameters: +// projectID - the project id. +// publishedName - specifies the name of the model to evaluate against. +// imageURL - an ImageUrl that contains the url of the image to be evaluated. +// application - optional. Specifies the name of application using the endpoint. +func (client BaseClient) ClassifyImageURL(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL ImageURL, application string) (result ImagePrediction, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ClassifyImageURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: imageURL, + Constraints: []validation.Constraint{{Target: "imageURL.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("prediction.BaseClient", "ClassifyImageURL", err.Error()) + } + + req, err := client.ClassifyImageURLPreparer(ctx, projectID, publishedName, imageURL, application) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImageURL", nil, "Failure preparing request") + return + } + + resp, err := client.ClassifyImageURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImageURL", resp, "Failure sending request") + return + } + + result, err = client.ClassifyImageURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImageURL", resp, "Failure responding to request") + } + + return +} + +// ClassifyImageURLPreparer prepares the ClassifyImageURL request. +func (client BaseClient) ClassifyImageURLPreparer(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL ImageURL, application string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "projectId": autorest.Encode("path", projectID), + "publishedName": autorest.Encode("path", publishedName), + } + + queryParameters := map[string]interface{}{} + if len(application) > 0 { + queryParameters["application"] = autorest.Encode("query", application) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.0/prediction", urlParameters), + autorest.WithPathParameters("/{projectId}/classify/iterations/{publishedName}/url", pathParameters), + autorest.WithJSON(imageURL), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Prediction-Key", client.APIKey)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ClassifyImageURLSender sends the ClassifyImageURL request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ClassifyImageURLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ClassifyImageURLResponder handles the response to the ClassifyImageURL request. The method always +// closes the http.Response Body. +func (client BaseClient) ClassifyImageURLResponder(resp *http.Response) (result ImagePrediction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ClassifyImageURLWithNoStore sends the classify image url with no store request. +// Parameters: +// projectID - the project id. +// publishedName - specifies the name of the model to evaluate against. +// imageURL - an {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be evaluated. +// application - optional. Specifies the name of application using the endpoint. +func (client BaseClient) ClassifyImageURLWithNoStore(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL ImageURL, application string) (result ImagePrediction, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ClassifyImageURLWithNoStore") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: imageURL, + Constraints: []validation.Constraint{{Target: "imageURL.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("prediction.BaseClient", "ClassifyImageURLWithNoStore", err.Error()) + } + + req, err := client.ClassifyImageURLWithNoStorePreparer(ctx, projectID, publishedName, imageURL, application) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImageURLWithNoStore", nil, "Failure preparing request") + return + } + + resp, err := client.ClassifyImageURLWithNoStoreSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImageURLWithNoStore", resp, "Failure sending request") + return + } + + result, err = client.ClassifyImageURLWithNoStoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImageURLWithNoStore", resp, "Failure responding to request") + } + + return +} + +// ClassifyImageURLWithNoStorePreparer prepares the ClassifyImageURLWithNoStore request. +func (client BaseClient) ClassifyImageURLWithNoStorePreparer(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL ImageURL, application string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "projectId": autorest.Encode("path", projectID), + "publishedName": autorest.Encode("path", publishedName), + } + + queryParameters := map[string]interface{}{} + if len(application) > 0 { + queryParameters["application"] = autorest.Encode("query", application) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.0/prediction", urlParameters), + autorest.WithPathParameters("/{projectId}/classify/iterations/{publishedName}/url/nostore", pathParameters), + autorest.WithJSON(imageURL), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Prediction-Key", client.APIKey)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ClassifyImageURLWithNoStoreSender sends the ClassifyImageURLWithNoStore request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ClassifyImageURLWithNoStoreSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ClassifyImageURLWithNoStoreResponder handles the response to the ClassifyImageURLWithNoStore request. The method always +// closes the http.Response Body. +func (client BaseClient) ClassifyImageURLWithNoStoreResponder(resp *http.Response) (result ImagePrediction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ClassifyImageWithNoStore sends the classify image with no store request. +// Parameters: +// projectID - the project id. +// publishedName - specifies the name of the model to evaluate against. +// imageData - binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. +// application - optional. Specifies the name of application using the endpoint. +func (client BaseClient) ClassifyImageWithNoStore(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (result ImagePrediction, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ClassifyImageWithNoStore") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ClassifyImageWithNoStorePreparer(ctx, projectID, publishedName, imageData, application) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImageWithNoStore", nil, "Failure preparing request") + return + } + + resp, err := client.ClassifyImageWithNoStoreSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImageWithNoStore", resp, "Failure sending request") + return + } + + result, err = client.ClassifyImageWithNoStoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "ClassifyImageWithNoStore", resp, "Failure responding to request") + } + + return +} + +// ClassifyImageWithNoStorePreparer prepares the ClassifyImageWithNoStore request. +func (client BaseClient) ClassifyImageWithNoStorePreparer(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "projectId": autorest.Encode("path", projectID), + "publishedName": autorest.Encode("path", publishedName), + } + + queryParameters := map[string]interface{}{} + if len(application) > 0 { + queryParameters["application"] = autorest.Encode("query", application) + } + + formDataParameters := map[string]interface{}{ + "imageData": imageData, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.0/prediction", urlParameters), + autorest.WithPathParameters("/{projectId}/classify/iterations/{publishedName}/image/nostore", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithMultiPartFormData(formDataParameters), + autorest.WithHeader("Prediction-Key", client.APIKey)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ClassifyImageWithNoStoreSender sends the ClassifyImageWithNoStore request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ClassifyImageWithNoStoreSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ClassifyImageWithNoStoreResponder handles the response to the ClassifyImageWithNoStore request. The method always +// closes the http.Response Body. +func (client BaseClient) ClassifyImageWithNoStoreResponder(resp *http.Response) (result ImagePrediction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DetectImage sends the detect image request. +// Parameters: +// projectID - the project id. +// publishedName - specifies the name of the model to evaluate against. +// imageData - binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. +// application - optional. Specifies the name of application using the endpoint. +func (client BaseClient) DetectImage(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (result ImagePrediction, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DetectImage") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DetectImagePreparer(ctx, projectID, publishedName, imageData, application) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImage", nil, "Failure preparing request") + return + } + + resp, err := client.DetectImageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImage", resp, "Failure sending request") + return + } + + result, err = client.DetectImageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImage", resp, "Failure responding to request") + } + + return +} + +// DetectImagePreparer prepares the DetectImage request. +func (client BaseClient) DetectImagePreparer(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "projectId": autorest.Encode("path", projectID), + "publishedName": autorest.Encode("path", publishedName), + } + + queryParameters := map[string]interface{}{} + if len(application) > 0 { + queryParameters["application"] = autorest.Encode("query", application) + } + + formDataParameters := map[string]interface{}{ + "imageData": imageData, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.0/prediction", urlParameters), + autorest.WithPathParameters("/{projectId}/detect/iterations/{publishedName}/image", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithMultiPartFormData(formDataParameters), + autorest.WithHeader("Prediction-Key", client.APIKey)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetectImageSender sends the DetectImage request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DetectImageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DetectImageResponder handles the response to the DetectImage request. The method always +// closes the http.Response Body. +func (client BaseClient) DetectImageResponder(resp *http.Response) (result ImagePrediction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DetectImageURL sends the detect image url request. +// Parameters: +// projectID - the project id. +// publishedName - specifies the name of the model to evaluate against. +// imageURL - an ImageUrl that contains the url of the image to be evaluated. +// application - optional. Specifies the name of application using the endpoint. +func (client BaseClient) DetectImageURL(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL ImageURL, application string) (result ImagePrediction, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DetectImageURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: imageURL, + Constraints: []validation.Constraint{{Target: "imageURL.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("prediction.BaseClient", "DetectImageURL", err.Error()) + } + + req, err := client.DetectImageURLPreparer(ctx, projectID, publishedName, imageURL, application) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImageURL", nil, "Failure preparing request") + return + } + + resp, err := client.DetectImageURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImageURL", resp, "Failure sending request") + return + } + + result, err = client.DetectImageURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImageURL", resp, "Failure responding to request") + } + + return +} + +// DetectImageURLPreparer prepares the DetectImageURL request. +func (client BaseClient) DetectImageURLPreparer(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL ImageURL, application string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "projectId": autorest.Encode("path", projectID), + "publishedName": autorest.Encode("path", publishedName), + } + + queryParameters := map[string]interface{}{} + if len(application) > 0 { + queryParameters["application"] = autorest.Encode("query", application) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.0/prediction", urlParameters), + autorest.WithPathParameters("/{projectId}/detect/iterations/{publishedName}/url", pathParameters), + autorest.WithJSON(imageURL), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Prediction-Key", client.APIKey)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetectImageURLSender sends the DetectImageURL request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DetectImageURLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DetectImageURLResponder handles the response to the DetectImageURL request. The method always +// closes the http.Response Body. +func (client BaseClient) DetectImageURLResponder(resp *http.Response) (result ImagePrediction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DetectImageURLWithNoStore sends the detect image url with no store request. +// Parameters: +// projectID - the project id. +// publishedName - specifies the name of the model to evaluate against. +// imageURL - an {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be evaluated. +// application - optional. Specifies the name of application using the endpoint. +func (client BaseClient) DetectImageURLWithNoStore(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL ImageURL, application string) (result ImagePrediction, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DetectImageURLWithNoStore") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: imageURL, + Constraints: []validation.Constraint{{Target: "imageURL.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("prediction.BaseClient", "DetectImageURLWithNoStore", err.Error()) + } + + req, err := client.DetectImageURLWithNoStorePreparer(ctx, projectID, publishedName, imageURL, application) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImageURLWithNoStore", nil, "Failure preparing request") + return + } + + resp, err := client.DetectImageURLWithNoStoreSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImageURLWithNoStore", resp, "Failure sending request") + return + } + + result, err = client.DetectImageURLWithNoStoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImageURLWithNoStore", resp, "Failure responding to request") + } + + return +} + +// DetectImageURLWithNoStorePreparer prepares the DetectImageURLWithNoStore request. +func (client BaseClient) DetectImageURLWithNoStorePreparer(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL ImageURL, application string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "projectId": autorest.Encode("path", projectID), + "publishedName": autorest.Encode("path", publishedName), + } + + queryParameters := map[string]interface{}{} + if len(application) > 0 { + queryParameters["application"] = autorest.Encode("query", application) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.0/prediction", urlParameters), + autorest.WithPathParameters("/{projectId}/detect/iterations/{publishedName}/url/nostore", pathParameters), + autorest.WithJSON(imageURL), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Prediction-Key", client.APIKey)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetectImageURLWithNoStoreSender sends the DetectImageURLWithNoStore request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DetectImageURLWithNoStoreSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DetectImageURLWithNoStoreResponder handles the response to the DetectImageURLWithNoStore request. The method always +// closes the http.Response Body. +func (client BaseClient) DetectImageURLWithNoStoreResponder(resp *http.Response) (result ImagePrediction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DetectImageWithNoStore sends the detect image with no store request. +// Parameters: +// projectID - the project id. +// publishedName - specifies the name of the model to evaluate against. +// imageData - binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. +// application - optional. Specifies the name of application using the endpoint. +func (client BaseClient) DetectImageWithNoStore(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (result ImagePrediction, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DetectImageWithNoStore") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DetectImageWithNoStorePreparer(ctx, projectID, publishedName, imageData, application) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImageWithNoStore", nil, "Failure preparing request") + return + } + + resp, err := client.DetectImageWithNoStoreSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImageWithNoStore", resp, "Failure sending request") + return + } + + result, err = client.DetectImageWithNoStoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "prediction.BaseClient", "DetectImageWithNoStore", resp, "Failure responding to request") + } + + return +} + +// DetectImageWithNoStorePreparer prepares the DetectImageWithNoStore request. +func (client BaseClient) DetectImageWithNoStorePreparer(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + pathParameters := map[string]interface{}{ + "projectId": autorest.Encode("path", projectID), + "publishedName": autorest.Encode("path", publishedName), + } + + queryParameters := map[string]interface{}{} + if len(application) > 0 { + queryParameters["application"] = autorest.Encode("query", application) + } + + formDataParameters := map[string]interface{}{ + "imageData": imageData, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/customvision/v3.0/prediction", urlParameters), + autorest.WithPathParameters("/{projectId}/detect/iterations/{publishedName}/image/nostore", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithMultiPartFormData(formDataParameters), + autorest.WithHeader("Prediction-Key", client.APIKey)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetectImageWithNoStoreSender sends the DetectImageWithNoStore request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DetectImageWithNoStoreSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DetectImageWithNoStoreResponder handles the response to the DetectImageWithNoStore request. The method always +// closes the http.Response Body. +func (client BaseClient) DetectImageWithNoStoreResponder(resp *http.Response) (result ImagePrediction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cognitiveservices/v3.0/customvision/prediction/models.go b/services/cognitiveservices/v3.0/customvision/prediction/models.go new file mode 100644 index 000000000000..8f0a6897c548 --- /dev/null +++ b/services/cognitiveservices/v3.0/customvision/prediction/models.go @@ -0,0 +1,315 @@ +package prediction + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/satori/go.uuid" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v3.0/customvision/prediction" + +// CustomVisionErrorCodes enumerates the values for custom vision error codes. +type CustomVisionErrorCodes string + +const ( + // BadRequest ... + BadRequest CustomVisionErrorCodes = "BadRequest" + // BadRequestCannotMigrateProjectWithName ... + BadRequestCannotMigrateProjectWithName CustomVisionErrorCodes = "BadRequestCannotMigrateProjectWithName" + // BadRequestClassificationTrainingValidationFailed ... + BadRequestClassificationTrainingValidationFailed CustomVisionErrorCodes = "BadRequestClassificationTrainingValidationFailed" + // BadRequestDetectionTrainingNotAllowNegativeTag ... + BadRequestDetectionTrainingNotAllowNegativeTag CustomVisionErrorCodes = "BadRequestDetectionTrainingNotAllowNegativeTag" + // BadRequestDetectionTrainingValidationFailed ... + BadRequestDetectionTrainingValidationFailed CustomVisionErrorCodes = "BadRequestDetectionTrainingValidationFailed" + // BadRequestDomainNotSupportedForAdvancedTraining ... + BadRequestDomainNotSupportedForAdvancedTraining CustomVisionErrorCodes = "BadRequestDomainNotSupportedForAdvancedTraining" + // BadRequestExceededBatchSize ... + BadRequestExceededBatchSize CustomVisionErrorCodes = "BadRequestExceededBatchSize" + // BadRequestExceededQuota ... + BadRequestExceededQuota CustomVisionErrorCodes = "BadRequestExceededQuota" + // BadRequestExceedIterationPerProjectLimit ... + BadRequestExceedIterationPerProjectLimit CustomVisionErrorCodes = "BadRequestExceedIterationPerProjectLimit" + // BadRequestExceedProjectLimit ... + BadRequestExceedProjectLimit CustomVisionErrorCodes = "BadRequestExceedProjectLimit" + // BadRequestExceedTagPerImageLimit ... + BadRequestExceedTagPerImageLimit CustomVisionErrorCodes = "BadRequestExceedTagPerImageLimit" + // BadRequestExceedTagPerProjectLimit ... + BadRequestExceedTagPerProjectLimit CustomVisionErrorCodes = "BadRequestExceedTagPerProjectLimit" + // BadRequestExportAlreadyInProgress ... + BadRequestExportAlreadyInProgress CustomVisionErrorCodes = "BadRequestExportAlreadyInProgress" + // BadRequestExportPlatformNotSupportedForAdvancedTraining ... + BadRequestExportPlatformNotSupportedForAdvancedTraining CustomVisionErrorCodes = "BadRequestExportPlatformNotSupportedForAdvancedTraining" + // BadRequestExportValidationFailed ... + BadRequestExportValidationFailed CustomVisionErrorCodes = "BadRequestExportValidationFailed" + // BadRequestImageBatch ... + BadRequestImageBatch CustomVisionErrorCodes = "BadRequestImageBatch" + // BadRequestImageExceededCount ... + BadRequestImageExceededCount CustomVisionErrorCodes = "BadRequestImageExceededCount" + // BadRequestImageFormat ... + BadRequestImageFormat CustomVisionErrorCodes = "BadRequestImageFormat" + // BadRequestImageRegions ... + BadRequestImageRegions CustomVisionErrorCodes = "BadRequestImageRegions" + // BadRequestImageSizeBytes ... + BadRequestImageSizeBytes CustomVisionErrorCodes = "BadRequestImageSizeBytes" + // BadRequestImageStream ... + BadRequestImageStream CustomVisionErrorCodes = "BadRequestImageStream" + // BadRequestImageTags ... + BadRequestImageTags CustomVisionErrorCodes = "BadRequestImageTags" + // BadRequestImageURL ... + BadRequestImageURL CustomVisionErrorCodes = "BadRequestImageUrl" + // BadRequestInvalid ... + BadRequestInvalid CustomVisionErrorCodes = "BadRequestInvalid" + // BadRequestInvalidEmailAddress ... + BadRequestInvalidEmailAddress CustomVisionErrorCodes = "BadRequestInvalidEmailAddress" + // BadRequestInvalidIds ... + BadRequestInvalidIds CustomVisionErrorCodes = "BadRequestInvalidIds" + // BadRequestInvalidPublishName ... + BadRequestInvalidPublishName CustomVisionErrorCodes = "BadRequestInvalidPublishName" + // BadRequestInvalidPublishTarget ... + BadRequestInvalidPublishTarget CustomVisionErrorCodes = "BadRequestInvalidPublishTarget" + // BadRequestIterationDescription ... + BadRequestIterationDescription CustomVisionErrorCodes = "BadRequestIterationDescription" + // BadRequestIterationIsNotTrained ... + BadRequestIterationIsNotTrained CustomVisionErrorCodes = "BadRequestIterationIsNotTrained" + // BadRequestIterationIsPublished ... + BadRequestIterationIsPublished CustomVisionErrorCodes = "BadRequestIterationIsPublished" + // BadRequestIterationName ... + BadRequestIterationName CustomVisionErrorCodes = "BadRequestIterationName" + // BadRequestIterationNameNotUnique ... + BadRequestIterationNameNotUnique CustomVisionErrorCodes = "BadRequestIterationNameNotUnique" + // BadRequestMultiClassClassificationTrainingValidationFailed ... + BadRequestMultiClassClassificationTrainingValidationFailed CustomVisionErrorCodes = "BadRequestMultiClassClassificationTrainingValidationFailed" + // BadRequestMultiLabelClassificationTrainingValidationFailed ... + BadRequestMultiLabelClassificationTrainingValidationFailed CustomVisionErrorCodes = "BadRequestMultiLabelClassificationTrainingValidationFailed" + // BadRequestMultipleNegativeTag ... + BadRequestMultipleNegativeTag CustomVisionErrorCodes = "BadRequestMultipleNegativeTag" + // BadRequestNegativeAndRegularTagOnSameImage ... + BadRequestNegativeAndRegularTagOnSameImage CustomVisionErrorCodes = "BadRequestNegativeAndRegularTagOnSameImage" + // BadRequestNotLimitedTrial ... + BadRequestNotLimitedTrial CustomVisionErrorCodes = "BadRequestNotLimitedTrial" + // BadRequestNotSupported ... + BadRequestNotSupported CustomVisionErrorCodes = "BadRequestNotSupported" + // BadRequestPredictionIdsExceededCount ... + BadRequestPredictionIdsExceededCount CustomVisionErrorCodes = "BadRequestPredictionIdsExceededCount" + // BadRequestPredictionIdsMissing ... + BadRequestPredictionIdsMissing CustomVisionErrorCodes = "BadRequestPredictionIdsMissing" + // BadRequestPredictionInvalidApplicationName ... + BadRequestPredictionInvalidApplicationName CustomVisionErrorCodes = "BadRequestPredictionInvalidApplicationName" + // BadRequestPredictionInvalidQueryParameters ... + BadRequestPredictionInvalidQueryParameters CustomVisionErrorCodes = "BadRequestPredictionInvalidQueryParameters" + // BadRequestPredictionResultsExceededCount ... + BadRequestPredictionResultsExceededCount CustomVisionErrorCodes = "BadRequestPredictionResultsExceededCount" + // BadRequestPredictionTagsExceededCount ... + BadRequestPredictionTagsExceededCount CustomVisionErrorCodes = "BadRequestPredictionTagsExceededCount" + // BadRequestProjectDescription ... + BadRequestProjectDescription CustomVisionErrorCodes = "BadRequestProjectDescription" + // BadRequestProjectName ... + BadRequestProjectName CustomVisionErrorCodes = "BadRequestProjectName" + // BadRequestProjectNameNotUnique ... + BadRequestProjectNameNotUnique CustomVisionErrorCodes = "BadRequestProjectNameNotUnique" + // BadRequestProjectUnknownClassification ... + BadRequestProjectUnknownClassification CustomVisionErrorCodes = "BadRequestProjectUnknownClassification" + // BadRequestProjectUnknownDomain ... + BadRequestProjectUnknownDomain CustomVisionErrorCodes = "BadRequestProjectUnknownDomain" + // BadRequestProjectUnsupportedDomainTypeChange ... + BadRequestProjectUnsupportedDomainTypeChange CustomVisionErrorCodes = "BadRequestProjectUnsupportedDomainTypeChange" + // BadRequestProjectUnsupportedExportPlatform ... + BadRequestProjectUnsupportedExportPlatform CustomVisionErrorCodes = "BadRequestProjectUnsupportedExportPlatform" + // BadRequestRequiredParamIsNull ... + BadRequestRequiredParamIsNull CustomVisionErrorCodes = "BadRequestRequiredParamIsNull" + // BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining ... + BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining CustomVisionErrorCodes = "BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining" + // BadRequestSubscriptionAPI ... + BadRequestSubscriptionAPI CustomVisionErrorCodes = "BadRequestSubscriptionApi" + // BadRequestTagDescription ... + BadRequestTagDescription CustomVisionErrorCodes = "BadRequestTagDescription" + // BadRequestTagName ... + BadRequestTagName CustomVisionErrorCodes = "BadRequestTagName" + // BadRequestTagNameNotUnique ... + BadRequestTagNameNotUnique CustomVisionErrorCodes = "BadRequestTagNameNotUnique" + // BadRequestTagType ... + BadRequestTagType CustomVisionErrorCodes = "BadRequestTagType" + // BadRequestTrainingAlreadyInProgress ... + BadRequestTrainingAlreadyInProgress CustomVisionErrorCodes = "BadRequestTrainingAlreadyInProgress" + // BadRequestTrainingNotNeeded ... + BadRequestTrainingNotNeeded CustomVisionErrorCodes = "BadRequestTrainingNotNeeded" + // BadRequestTrainingNotNeededButTrainingPipelineUpdated ... + BadRequestTrainingNotNeededButTrainingPipelineUpdated CustomVisionErrorCodes = "BadRequestTrainingNotNeededButTrainingPipelineUpdated" + // BadRequestTrainingValidationFailed ... + BadRequestTrainingValidationFailed CustomVisionErrorCodes = "BadRequestTrainingValidationFailed" + // BadRequestUnpublishFailed ... + BadRequestUnpublishFailed CustomVisionErrorCodes = "BadRequestUnpublishFailed" + // BadRequestWorkspaceCannotBeModified ... + BadRequestWorkspaceCannotBeModified CustomVisionErrorCodes = "BadRequestWorkspaceCannotBeModified" + // BadRequestWorkspaceNotDeletable ... + BadRequestWorkspaceNotDeletable CustomVisionErrorCodes = "BadRequestWorkspaceNotDeletable" + // Conflict ... + Conflict CustomVisionErrorCodes = "Conflict" + // ConflictInvalid ... + ConflictInvalid CustomVisionErrorCodes = "ConflictInvalid" + // ErrorExporterInvalidClassifier ... + ErrorExporterInvalidClassifier CustomVisionErrorCodes = "ErrorExporterInvalidClassifier" + // ErrorExporterInvalidFeaturizer ... + ErrorExporterInvalidFeaturizer CustomVisionErrorCodes = "ErrorExporterInvalidFeaturizer" + // ErrorExporterInvalidPlatform ... + ErrorExporterInvalidPlatform CustomVisionErrorCodes = "ErrorExporterInvalidPlatform" + // ErrorFeaturizationAugmentationError ... + ErrorFeaturizationAugmentationError CustomVisionErrorCodes = "ErrorFeaturizationAugmentationError" + // ErrorFeaturizationAugmentationUnavailable ... + ErrorFeaturizationAugmentationUnavailable CustomVisionErrorCodes = "ErrorFeaturizationAugmentationUnavailable" + // ErrorFeaturizationInvalidFeaturizer ... + ErrorFeaturizationInvalidFeaturizer CustomVisionErrorCodes = "ErrorFeaturizationInvalidFeaturizer" + // ErrorFeaturizationQueueTimeout ... + ErrorFeaturizationQueueTimeout CustomVisionErrorCodes = "ErrorFeaturizationQueueTimeout" + // ErrorFeaturizationServiceUnavailable ... + ErrorFeaturizationServiceUnavailable CustomVisionErrorCodes = "ErrorFeaturizationServiceUnavailable" + // ErrorFeaturizationUnrecognizedJob ... + ErrorFeaturizationUnrecognizedJob CustomVisionErrorCodes = "ErrorFeaturizationUnrecognizedJob" + // ErrorInvalid ... + ErrorInvalid CustomVisionErrorCodes = "ErrorInvalid" + // ErrorPrediction ... + ErrorPrediction CustomVisionErrorCodes = "ErrorPrediction" + // ErrorPredictionModelNotCached ... + ErrorPredictionModelNotCached CustomVisionErrorCodes = "ErrorPredictionModelNotCached" + // ErrorPredictionModelNotFound ... + ErrorPredictionModelNotFound CustomVisionErrorCodes = "ErrorPredictionModelNotFound" + // ErrorPredictionServiceUnavailable ... + ErrorPredictionServiceUnavailable CustomVisionErrorCodes = "ErrorPredictionServiceUnavailable" + // ErrorPredictionStorage ... + ErrorPredictionStorage CustomVisionErrorCodes = "ErrorPredictionStorage" + // ErrorProjectExportRequestFailed ... + ErrorProjectExportRequestFailed CustomVisionErrorCodes = "ErrorProjectExportRequestFailed" + // ErrorProjectInvalidDomain ... + ErrorProjectInvalidDomain CustomVisionErrorCodes = "ErrorProjectInvalidDomain" + // ErrorProjectInvalidPipelineConfiguration ... + ErrorProjectInvalidPipelineConfiguration CustomVisionErrorCodes = "ErrorProjectInvalidPipelineConfiguration" + // ErrorProjectInvalidWorkspace ... + ErrorProjectInvalidWorkspace CustomVisionErrorCodes = "ErrorProjectInvalidWorkspace" + // ErrorProjectTrainingRequestFailed ... + ErrorProjectTrainingRequestFailed CustomVisionErrorCodes = "ErrorProjectTrainingRequestFailed" + // ErrorRegionProposal ... + ErrorRegionProposal CustomVisionErrorCodes = "ErrorRegionProposal" + // ErrorUnknown ... + ErrorUnknown CustomVisionErrorCodes = "ErrorUnknown" + // Forbidden ... + Forbidden CustomVisionErrorCodes = "Forbidden" + // ForbiddenDRModeEnabled ... + ForbiddenDRModeEnabled CustomVisionErrorCodes = "ForbiddenDRModeEnabled" + // ForbiddenInvalid ... + ForbiddenInvalid CustomVisionErrorCodes = "ForbiddenInvalid" + // ForbiddenUser ... + ForbiddenUser CustomVisionErrorCodes = "ForbiddenUser" + // ForbiddenUserDisabled ... + ForbiddenUserDisabled CustomVisionErrorCodes = "ForbiddenUserDisabled" + // ForbiddenUserDoesNotExist ... + ForbiddenUserDoesNotExist CustomVisionErrorCodes = "ForbiddenUserDoesNotExist" + // ForbiddenUserInsufficientCapability ... + ForbiddenUserInsufficientCapability CustomVisionErrorCodes = "ForbiddenUserInsufficientCapability" + // ForbiddenUserResource ... + ForbiddenUserResource CustomVisionErrorCodes = "ForbiddenUserResource" + // ForbiddenUserSignupAllowanceExceeded ... + ForbiddenUserSignupAllowanceExceeded CustomVisionErrorCodes = "ForbiddenUserSignupAllowanceExceeded" + // ForbiddenUserSignupDisabled ... + ForbiddenUserSignupDisabled CustomVisionErrorCodes = "ForbiddenUserSignupDisabled" + // NoError ... + NoError CustomVisionErrorCodes = "NoError" + // NotFound ... + NotFound CustomVisionErrorCodes = "NotFound" + // NotFoundApimSubscription ... + NotFoundApimSubscription CustomVisionErrorCodes = "NotFoundApimSubscription" + // NotFoundDomain ... + NotFoundDomain CustomVisionErrorCodes = "NotFoundDomain" + // NotFoundImage ... + NotFoundImage CustomVisionErrorCodes = "NotFoundImage" + // NotFoundInvalid ... + NotFoundInvalid CustomVisionErrorCodes = "NotFoundInvalid" + // NotFoundIteration ... + NotFoundIteration CustomVisionErrorCodes = "NotFoundIteration" + // NotFoundIterationPerformance ... + NotFoundIterationPerformance CustomVisionErrorCodes = "NotFoundIterationPerformance" + // NotFoundProject ... + NotFoundProject CustomVisionErrorCodes = "NotFoundProject" + // NotFoundProjectDefaultIteration ... + NotFoundProjectDefaultIteration CustomVisionErrorCodes = "NotFoundProjectDefaultIteration" + // NotFoundTag ... + NotFoundTag CustomVisionErrorCodes = "NotFoundTag" + // UnsupportedMediaType ... + UnsupportedMediaType CustomVisionErrorCodes = "UnsupportedMediaType" +) + +// PossibleCustomVisionErrorCodesValues returns an array of possible values for the CustomVisionErrorCodes const type. +func PossibleCustomVisionErrorCodesValues() []CustomVisionErrorCodes { + return []CustomVisionErrorCodes{BadRequest, BadRequestCannotMigrateProjectWithName, BadRequestClassificationTrainingValidationFailed, BadRequestDetectionTrainingNotAllowNegativeTag, BadRequestDetectionTrainingValidationFailed, BadRequestDomainNotSupportedForAdvancedTraining, BadRequestExceededBatchSize, BadRequestExceededQuota, BadRequestExceedIterationPerProjectLimit, BadRequestExceedProjectLimit, BadRequestExceedTagPerImageLimit, BadRequestExceedTagPerProjectLimit, BadRequestExportAlreadyInProgress, BadRequestExportPlatformNotSupportedForAdvancedTraining, BadRequestExportValidationFailed, BadRequestImageBatch, BadRequestImageExceededCount, BadRequestImageFormat, BadRequestImageRegions, BadRequestImageSizeBytes, BadRequestImageStream, BadRequestImageTags, BadRequestImageURL, BadRequestInvalid, BadRequestInvalidEmailAddress, BadRequestInvalidIds, BadRequestInvalidPublishName, BadRequestInvalidPublishTarget, BadRequestIterationDescription, BadRequestIterationIsNotTrained, BadRequestIterationIsPublished, BadRequestIterationName, BadRequestIterationNameNotUnique, BadRequestMultiClassClassificationTrainingValidationFailed, BadRequestMultiLabelClassificationTrainingValidationFailed, BadRequestMultipleNegativeTag, BadRequestNegativeAndRegularTagOnSameImage, BadRequestNotLimitedTrial, BadRequestNotSupported, BadRequestPredictionIdsExceededCount, BadRequestPredictionIdsMissing, BadRequestPredictionInvalidApplicationName, BadRequestPredictionInvalidQueryParameters, BadRequestPredictionResultsExceededCount, BadRequestPredictionTagsExceededCount, BadRequestProjectDescription, BadRequestProjectName, BadRequestProjectNameNotUnique, BadRequestProjectUnknownClassification, BadRequestProjectUnknownDomain, BadRequestProjectUnsupportedDomainTypeChange, BadRequestProjectUnsupportedExportPlatform, BadRequestRequiredParamIsNull, BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining, BadRequestSubscriptionAPI, BadRequestTagDescription, BadRequestTagName, BadRequestTagNameNotUnique, BadRequestTagType, BadRequestTrainingAlreadyInProgress, BadRequestTrainingNotNeeded, BadRequestTrainingNotNeededButTrainingPipelineUpdated, BadRequestTrainingValidationFailed, BadRequestUnpublishFailed, BadRequestWorkspaceCannotBeModified, BadRequestWorkspaceNotDeletable, Conflict, ConflictInvalid, ErrorExporterInvalidClassifier, ErrorExporterInvalidFeaturizer, ErrorExporterInvalidPlatform, ErrorFeaturizationAugmentationError, ErrorFeaturizationAugmentationUnavailable, ErrorFeaturizationInvalidFeaturizer, ErrorFeaturizationQueueTimeout, ErrorFeaturizationServiceUnavailable, ErrorFeaturizationUnrecognizedJob, ErrorInvalid, ErrorPrediction, ErrorPredictionModelNotCached, ErrorPredictionModelNotFound, ErrorPredictionServiceUnavailable, ErrorPredictionStorage, ErrorProjectExportRequestFailed, ErrorProjectInvalidDomain, ErrorProjectInvalidPipelineConfiguration, ErrorProjectInvalidWorkspace, ErrorProjectTrainingRequestFailed, ErrorRegionProposal, ErrorUnknown, Forbidden, ForbiddenDRModeEnabled, ForbiddenInvalid, ForbiddenUser, ForbiddenUserDisabled, ForbiddenUserDoesNotExist, ForbiddenUserInsufficientCapability, ForbiddenUserResource, ForbiddenUserSignupAllowanceExceeded, ForbiddenUserSignupDisabled, NoError, NotFound, NotFoundApimSubscription, NotFoundDomain, NotFoundImage, NotFoundInvalid, NotFoundIteration, NotFoundIterationPerformance, NotFoundProject, NotFoundProjectDefaultIteration, NotFoundTag, UnsupportedMediaType} +} + +// BoundingBox bounding box that defines a region of an image. +type BoundingBox struct { + // Left - Coordinate of the left boundary. + Left *float64 `json:"left,omitempty"` + // Top - Coordinate of the top boundary. + Top *float64 `json:"top,omitempty"` + // Width - Width. + Width *float64 `json:"width,omitempty"` + // Height - Height. + Height *float64 `json:"height,omitempty"` +} + +// CustomVisionError ... +type CustomVisionError struct { + // Code - The error code. Possible values include: 'NoError', 'BadRequest', 'BadRequestExceededBatchSize', 'BadRequestNotSupported', 'BadRequestInvalidIds', 'BadRequestProjectName', 'BadRequestProjectNameNotUnique', 'BadRequestProjectDescription', 'BadRequestProjectUnknownDomain', 'BadRequestProjectUnknownClassification', 'BadRequestProjectUnsupportedDomainTypeChange', 'BadRequestProjectUnsupportedExportPlatform', 'BadRequestIterationName', 'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription', 'BadRequestIterationIsNotTrained', 'BadRequestWorkspaceCannotBeModified', 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName', 'BadRequestTagNameNotUnique', 'BadRequestTagDescription', 'BadRequestTagType', 'BadRequestMultipleNegativeTag', 'BadRequestImageTags', 'BadRequestImageRegions', 'BadRequestNegativeAndRegularTagOnSameImage', 'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished', 'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget', 'BadRequestUnpublishFailed', 'BadRequestSubscriptionAPI', 'BadRequestExceedProjectLimit', 'BadRequestExceedIterationPerProjectLimit', 'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit', 'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName', 'BadRequestNotLimitedTrial', 'BadRequestImageBatch', 'BadRequestImageStream', 'BadRequestImageURL', 'BadRequestImageFormat', 'BadRequestImageSizeBytes', 'BadRequestImageExceededCount', 'BadRequestTrainingNotNeeded', 'BadRequestTrainingNotNeededButTrainingPipelineUpdated', 'BadRequestTrainingValidationFailed', 'BadRequestClassificationTrainingValidationFailed', 'BadRequestMultiClassClassificationTrainingValidationFailed', 'BadRequestMultiLabelClassificationTrainingValidationFailed', 'BadRequestDetectionTrainingValidationFailed', 'BadRequestTrainingAlreadyInProgress', 'BadRequestDetectionTrainingNotAllowNegativeTag', 'BadRequestInvalidEmailAddress', 'BadRequestDomainNotSupportedForAdvancedTraining', 'BadRequestExportPlatformNotSupportedForAdvancedTraining', 'BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining', 'BadRequestExportValidationFailed', 'BadRequestExportAlreadyInProgress', 'BadRequestPredictionIdsMissing', 'BadRequestPredictionIdsExceededCount', 'BadRequestPredictionTagsExceededCount', 'BadRequestPredictionResultsExceededCount', 'BadRequestPredictionInvalidApplicationName', 'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalid', 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', 'ForbiddenUserResource', 'ForbiddenUserSignupDisabled', 'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist', 'ForbiddenUserDisabled', 'ForbiddenUserInsufficientCapability', 'ForbiddenDRModeEnabled', 'ForbiddenInvalid', 'NotFound', 'NotFoundProject', 'NotFoundProjectDefaultIteration', 'NotFoundIteration', 'NotFoundIterationPerformance', 'NotFoundTag', 'NotFoundImage', 'NotFoundDomain', 'NotFoundApimSubscription', 'NotFoundInvalid', 'Conflict', 'ConflictInvalid', 'ErrorUnknown', 'ErrorProjectInvalidWorkspace', 'ErrorProjectInvalidPipelineConfiguration', 'ErrorProjectInvalidDomain', 'ErrorProjectTrainingRequestFailed', 'ErrorProjectExportRequestFailed', 'ErrorFeaturizationServiceUnavailable', 'ErrorFeaturizationQueueTimeout', 'ErrorFeaturizationInvalidFeaturizer', 'ErrorFeaturizationAugmentationUnavailable', 'ErrorFeaturizationUnrecognizedJob', 'ErrorFeaturizationAugmentationError', 'ErrorExporterInvalidPlatform', 'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier', 'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound', 'ErrorPredictionModelNotCached', 'ErrorPrediction', 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid' + Code CustomVisionErrorCodes `json:"code,omitempty"` + // Message - A message explaining the error reported by the service. + Message *string `json:"message,omitempty"` +} + +// ImagePrediction result of an image prediction request. +type ImagePrediction struct { + autorest.Response `json:"-"` + // ID - Prediction Id. + ID *uuid.UUID `json:"id,omitempty"` + // Project - Project Id. + Project *uuid.UUID `json:"project,omitempty"` + // Iteration - Iteration Id. + Iteration *uuid.UUID `json:"iteration,omitempty"` + // Created - Date this prediction was created. + Created *date.Time `json:"created,omitempty"` + // Predictions - List of predictions. + Predictions *[]Model `json:"predictions,omitempty"` +} + +// ImageURL image url. +type ImageURL struct { + // URL - Url of the image. + URL *string `json:"url,omitempty"` +} + +// Model prediction result. +type Model struct { + // Probability - Probability of the tag. + Probability *float64 `json:"probability,omitempty"` + // TagID - Id of the predicted tag. + TagID *uuid.UUID `json:"tagId,omitempty"` + // TagName - Name of the predicted tag. + TagName *string `json:"tagName,omitempty"` + // BoundingBox - Bounding box of the prediction. + BoundingBox *BoundingBox `json:"boundingBox,omitempty"` +} diff --git a/services/cognitiveservices/v3.0/customvision/prediction/predictionapi/interfaces.go b/services/cognitiveservices/v3.0/customvision/prediction/predictionapi/interfaces.go new file mode 100644 index 000000000000..83c145b08079 --- /dev/null +++ b/services/cognitiveservices/v3.0/customvision/prediction/predictionapi/interfaces.go @@ -0,0 +1,39 @@ +package predictionapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v3.0/customvision/prediction" + "github.com/satori/go.uuid" + "io" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + ClassifyImage(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (result prediction.ImagePrediction, err error) + ClassifyImageURL(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL prediction.ImageURL, application string) (result prediction.ImagePrediction, err error) + ClassifyImageURLWithNoStore(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL prediction.ImageURL, application string) (result prediction.ImagePrediction, err error) + ClassifyImageWithNoStore(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (result prediction.ImagePrediction, err error) + DetectImage(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (result prediction.ImagePrediction, err error) + DetectImageURL(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL prediction.ImageURL, application string) (result prediction.ImagePrediction, err error) + DetectImageURLWithNoStore(ctx context.Context, projectID uuid.UUID, publishedName string, imageURL prediction.ImageURL, application string) (result prediction.ImagePrediction, err error) + DetectImageWithNoStore(ctx context.Context, projectID uuid.UUID, publishedName string, imageData io.ReadCloser, application string) (result prediction.ImagePrediction, err error) +} + +var _ BaseClientAPI = (*prediction.BaseClient)(nil) diff --git a/services/cognitiveservices/v3.0/customvision/prediction/version.go b/services/cognitiveservices/v3.0/customvision/prediction/version.go new file mode 100644 index 000000000000..d3587b0a287b --- /dev/null +++ b/services/cognitiveservices/v3.0/customvision/prediction/version.go @@ -0,0 +1,30 @@ +package prediction + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " prediction/3.0" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}