From c54a7b763a5b2a66b82cda4f9a3080fbe1bc0e26 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 24 Jul 2018 18:50:34 +0000 Subject: [PATCH] Generated from a630b12320f25ed377697f8eb1c036b8e5965948 [cognitive Services] Update endpoint URL template for TextAnalytics. --- .../cognitiveservices/textanalytics/models.go | 32 ++------------ .../cognitiveservices/textanalytics/models.go | 32 ++------------ .../v2.0/textanalytics/client.go | 36 ++++++++-------- .../v2.0/textanalytics/models.go | 43 ------------------- 4 files changed, 26 insertions(+), 117 deletions(-) diff --git a/profiles/latest/cognitiveservices/textanalytics/models.go b/profiles/latest/cognitiveservices/textanalytics/models.go index 02b6c66dc0e4..a9b01ce73f34 100644 --- a/profiles/latest/cognitiveservices/textanalytics/models.go +++ b/profiles/latest/cognitiveservices/textanalytics/models.go @@ -22,27 +22,6 @@ package textanalytics import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/textanalytics" type BaseClient = original.BaseClient -type AzureRegions = original.AzureRegions - -const ( - Australiaeast AzureRegions = original.Australiaeast - Brazilsouth AzureRegions = original.Brazilsouth - Canadacentral AzureRegions = original.Canadacentral - Centralindia AzureRegions = original.Centralindia - Eastasia AzureRegions = original.Eastasia - Eastus AzureRegions = original.Eastus - Eastus2 AzureRegions = original.Eastus2 - Japaneast AzureRegions = original.Japaneast - Northeurope AzureRegions = original.Northeurope - Southcentralus AzureRegions = original.Southcentralus - Southeastasia AzureRegions = original.Southeastasia - Uksouth AzureRegions = original.Uksouth - Westcentralus AzureRegions = original.Westcentralus - Westeurope AzureRegions = original.Westeurope - Westus AzureRegions = original.Westus - Westus2 AzureRegions = original.Westus2 -) - type BatchInput = original.BatchInput type DetectedLanguage = original.DetectedLanguage type EntitiesBatchResult = original.EntitiesBatchResult @@ -62,14 +41,11 @@ type MultiLanguageInput = original.MultiLanguageInput type SentimentBatchResult = original.SentimentBatchResult type SentimentBatchResultItem = original.SentimentBatchResultItem -func New(azureRegion AzureRegions) BaseClient { - return original.New(azureRegion) -} -func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { - return original.NewWithoutDefaults(azureRegion) +func New(endpoint string) BaseClient { + return original.New(endpoint) } -func PossibleAzureRegionsValues() []AzureRegions { - return original.PossibleAzureRegionsValues() +func NewWithoutDefaults(endpoint string) BaseClient { + return original.NewWithoutDefaults(endpoint) } func UserAgent() string { return original.UserAgent() + " profiles/latest" diff --git a/profiles/preview/cognitiveservices/textanalytics/models.go b/profiles/preview/cognitiveservices/textanalytics/models.go index a49a4b4056b7..7f39cbbd6b0a 100644 --- a/profiles/preview/cognitiveservices/textanalytics/models.go +++ b/profiles/preview/cognitiveservices/textanalytics/models.go @@ -22,27 +22,6 @@ package textanalytics import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/textanalytics" type BaseClient = original.BaseClient -type AzureRegions = original.AzureRegions - -const ( - Australiaeast AzureRegions = original.Australiaeast - Brazilsouth AzureRegions = original.Brazilsouth - Canadacentral AzureRegions = original.Canadacentral - Centralindia AzureRegions = original.Centralindia - Eastasia AzureRegions = original.Eastasia - Eastus AzureRegions = original.Eastus - Eastus2 AzureRegions = original.Eastus2 - Japaneast AzureRegions = original.Japaneast - Northeurope AzureRegions = original.Northeurope - Southcentralus AzureRegions = original.Southcentralus - Southeastasia AzureRegions = original.Southeastasia - Uksouth AzureRegions = original.Uksouth - Westcentralus AzureRegions = original.Westcentralus - Westeurope AzureRegions = original.Westeurope - Westus AzureRegions = original.Westus - Westus2 AzureRegions = original.Westus2 -) - type BatchInput = original.BatchInput type DetectedLanguage = original.DetectedLanguage type EntitiesBatchResult = original.EntitiesBatchResult @@ -62,14 +41,11 @@ type MultiLanguageInput = original.MultiLanguageInput type SentimentBatchResult = original.SentimentBatchResult type SentimentBatchResultItem = original.SentimentBatchResultItem -func New(azureRegion AzureRegions) BaseClient { - return original.New(azureRegion) -} -func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { - return original.NewWithoutDefaults(azureRegion) +func New(endpoint string) BaseClient { + return original.New(endpoint) } -func PossibleAzureRegionsValues() []AzureRegions { - return original.PossibleAzureRegionsValues() +func NewWithoutDefaults(endpoint string) BaseClient { + return original.NewWithoutDefaults(endpoint) } func UserAgent() string { return original.UserAgent() + " profiles/preview" diff --git a/services/cognitiveservices/v2.0/textanalytics/client.go b/services/cognitiveservices/v2.0/textanalytics/client.go index 7af68608f791..56290cb68c06 100644 --- a/services/cognitiveservices/v2.0/textanalytics/client.go +++ b/services/cognitiveservices/v2.0/textanalytics/client.go @@ -34,19 +34,19 @@ import ( // BaseClient is the base client for Textanalytics. type BaseClient struct { autorest.Client - AzureRegion AzureRegions + Endpoint string } // New creates an instance of the BaseClient client. -func New(azureRegion AzureRegions) BaseClient { - return NewWithoutDefaults(azureRegion) +func New(endpoint string) BaseClient { + return NewWithoutDefaults(endpoint) } // NewWithoutDefaults creates an instance of the BaseClient client. -func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { +func NewWithoutDefaults(endpoint string) BaseClient { return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - AzureRegion: azureRegion, + Client: autorest.NewClientWithUserAgent(UserAgent()), + Endpoint: endpoint, } } @@ -79,14 +79,14 @@ func (client BaseClient) DetectLanguage(ctx context.Context, input BatchInput) ( // DetectLanguagePreparer prepares the DetectLanguage request. func (client BaseClient) DetectLanguagePreparer(ctx context.Context, input BatchInput) (*http.Request, error) { urlParameters := map[string]interface{}{ - "AzureRegion": client.AzureRegion, + "Endpoint": client.Endpoint, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), - autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/text/analytics", urlParameters), - autorest.WithPath("/v2.0/languages"), + autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.0", urlParameters), + autorest.WithPath("/languages"), autorest.WithJSON(input)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -142,14 +142,14 @@ func (client BaseClient) Entities(ctx context.Context, input MultiLanguageBatchI // EntitiesPreparer prepares the Entities request. func (client BaseClient) EntitiesPreparer(ctx context.Context, input MultiLanguageBatchInput) (*http.Request, error) { urlParameters := map[string]interface{}{ - "AzureRegion": client.AzureRegion, + "Endpoint": client.Endpoint, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), - autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/text/analytics", urlParameters), - autorest.WithPath("/v2.0/entities"), + autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.0", urlParameters), + autorest.WithPath("/entities"), autorest.WithJSON(input)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -205,14 +205,14 @@ func (client BaseClient) KeyPhrases(ctx context.Context, input MultiLanguageBatc // KeyPhrasesPreparer prepares the KeyPhrases request. func (client BaseClient) KeyPhrasesPreparer(ctx context.Context, input MultiLanguageBatchInput) (*http.Request, error) { urlParameters := map[string]interface{}{ - "AzureRegion": client.AzureRegion, + "Endpoint": client.Endpoint, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), - autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/text/analytics", urlParameters), - autorest.WithPath("/v2.0/keyPhrases"), + autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.0", urlParameters), + autorest.WithPath("/keyPhrases"), autorest.WithJSON(input)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -268,14 +268,14 @@ func (client BaseClient) Sentiment(ctx context.Context, input MultiLanguageBatch // SentimentPreparer prepares the Sentiment request. func (client BaseClient) SentimentPreparer(ctx context.Context, input MultiLanguageBatchInput) (*http.Request, error) { urlParameters := map[string]interface{}{ - "AzureRegion": client.AzureRegion, + "Endpoint": client.Endpoint, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), - autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/text/analytics", urlParameters), - autorest.WithPath("/v2.0/sentiment"), + autorest.WithCustomBaseURL("{Endpoint}/text/analytics/v2.0", urlParameters), + autorest.WithPath("/sentiment"), autorest.WithJSON(input)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/cognitiveservices/v2.0/textanalytics/models.go b/services/cognitiveservices/v2.0/textanalytics/models.go index 43c7fda25960..615a564563db 100644 --- a/services/cognitiveservices/v2.0/textanalytics/models.go +++ b/services/cognitiveservices/v2.0/textanalytics/models.go @@ -21,49 +21,6 @@ import ( "github.com/Azure/go-autorest/autorest" ) -// AzureRegions enumerates the values for azure regions. -type AzureRegions string - -const ( - // Australiaeast ... - Australiaeast AzureRegions = "australiaeast" - // Brazilsouth ... - Brazilsouth AzureRegions = "brazilsouth" - // Canadacentral ... - Canadacentral AzureRegions = "canadacentral" - // Centralindia ... - Centralindia AzureRegions = "centralindia" - // Eastasia ... - Eastasia AzureRegions = "eastasia" - // Eastus ... - Eastus AzureRegions = "eastus" - // Eastus2 ... - Eastus2 AzureRegions = "eastus2" - // Japaneast ... - Japaneast AzureRegions = "japaneast" - // Northeurope ... - Northeurope AzureRegions = "northeurope" - // Southcentralus ... - Southcentralus AzureRegions = "southcentralus" - // Southeastasia ... - Southeastasia AzureRegions = "southeastasia" - // Uksouth ... - Uksouth AzureRegions = "uksouth" - // Westcentralus ... - Westcentralus AzureRegions = "westcentralus" - // Westeurope ... - Westeurope AzureRegions = "westeurope" - // Westus ... - Westus AzureRegions = "westus" - // Westus2 ... - Westus2 AzureRegions = "westus2" -) - -// PossibleAzureRegionsValues returns an array of possible values for the AzureRegions const type. -func PossibleAzureRegionsValues() []AzureRegions { - return []AzureRegions{Australiaeast, Brazilsouth, Canadacentral, Centralindia, Eastasia, Eastus, Eastus2, Japaneast, Northeurope, Southcentralus, Southeastasia, Uksouth, Westcentralus, Westeurope, Westus, Westus2} -} - // BatchInput ... type BatchInput struct { Documents *[]Input `json:"documents,omitempty"`