vendor: update all dependencies to latest versions

This commit is contained in:
Nick Craig-Wood
2017-09-30 15:27:27 +01:00
parent 911d121bb9
commit b017fcfe9a
3048 changed files with 537055 additions and 189679 deletions
+194 -87
View File
@@ -14,9 +14,8 @@ package cognitiveservices
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// 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"
@@ -35,27 +34,21 @@ func NewAccountsClient(subscriptionID string) AccountsClient {
return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewAccountsClientWithBaseURI creates an instance of the AccountsClient
// client.
// NewAccountsClientWithBaseURI creates an instance of the AccountsClient client.
func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient {
return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Create create Cognitive Services Account. Accounts is a resource group wide
// resource type. It holds the keys for developer to access intelligent APIs.
// It's also the resource type for billing.
// Create create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for
// developer to access intelligent APIs. It's also the resource type for billing.
//
// resourceGroupName is the name of the resource group within the user's
// subscription. accountName is the name of the cognitive services account
// within the specified resource group. Cognitive Services account names must
// be between 3 and 24 characters in length and use numbers and lower-case
// letters only. parameters is the parameters to provide for the created
// account.
// resourceGroupName is the name of the resource group within the user's subscription. accountName is the name of
// Cognitive Services account. parameters is the parameters to provide for the created account.
func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters) (result Account, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil},
{Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil},
@@ -93,7 +86,7 @@ func (client AccountsClient) CreatePreparer(resourceGroupName string, accountNam
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-02-01-preview"
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -129,16 +122,13 @@ func (client AccountsClient) CreateResponder(resp *http.Response) (result Accoun
// Delete deletes a Cognitive Services account from the resource group.
//
// resourceGroupName is the name of the resource group within the user's
// subscription. accountName is the name of the cognitive services account
// within the specified resource group. Cognitive Services account names must
// be between 3 and 24 characters in length and use numbers and lower-case
// letters only.
// resourceGroupName is the name of the resource group within the user's subscription. accountName is the name of
// Cognitive Services account.
func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil},
{Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "Delete")
}
@@ -172,7 +162,7 @@ func (client AccountsClient) DeletePreparer(resourceGroupName string, accountNam
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-02-01-preview"
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -203,19 +193,15 @@ func (client AccountsClient) DeleteResponder(resp *http.Response) (result autore
return
}
// GetProperties returns a Cognitive Services account specified by the
// parameters.
// GetProperties returns a Cognitive Services account specified by the parameters.
//
// resourceGroupName is the name of the resource group within the user's
// subscription. accountName is the name of the cognitive services account
// within the specified resource group. Cognitive Services account names must
// be between 3 and 24 characters in length and use numbers and lower-case
// letters only.
// resourceGroupName is the name of the resource group within the user's subscription. accountName is the name of
// Cognitive Services account.
func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil},
{Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "GetProperties")
}
@@ -249,7 +235,7 @@ func (client AccountsClient) GetPropertiesPreparer(resourceGroupName string, acc
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-02-01-preview"
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -281,8 +267,7 @@ func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result
return
}
// List returns all the resources of a particular type belonging to a
// subscription.
// List returns all the resources of a particular type belonging to a subscription.
func (client AccountsClient) List() (result AccountListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
@@ -311,7 +296,7 @@ func (client AccountsClient) ListPreparer() (*http.Request, error) {
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-02-01-preview"
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -343,11 +328,78 @@ func (client AccountsClient) ListResponder(resp *http.Response) (result AccountL
return
}
// ListByResourceGroup returns all the resources of a particular type belonging
// to a resource group
// ListNextResults retrieves the next set of results, if any.
func (client AccountsClient) ListNextResults(lastResults AccountListResult) (result AccountListResult, err error) {
req, err := lastResults.AccountListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListComplete gets all elements from the list without paging.
func (client AccountsClient) ListComplete(cancel <-chan struct{}) (<-chan Account, <-chan error) {
resultChan := make(chan Account)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// ListByResourceGroup returns all the resources of a particular type belonging to a resource group
//
// resourceGroupName is the name of the resource group within the user's
// subscription.
// resourceGroupName is the name of the resource group within the user's subscription.
func (client AccountsClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
@@ -377,7 +429,7 @@ func (client AccountsClient) ListByResourceGroupPreparer(resourceGroupName strin
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-02-01-preview"
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -409,19 +461,84 @@ func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (
return
}
// ListKeys lists the account keys for the specified Cognitive Services
// account.
// ListByResourceGroupNextResults retrieves the next set of results, if any.
func (client AccountsClient) ListByResourceGroupNextResults(lastResults AccountListResult) (result AccountListResult, err error) {
req, err := lastResults.AccountListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", resp, "Failure sending next results request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", resp, "Failure responding to next results request")
}
return
}
// ListByResourceGroupComplete gets all elements from the list without paging.
func (client AccountsClient) ListByResourceGroupComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan Account, <-chan error) {
resultChan := make(chan Account)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListByResourceGroup(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListByResourceGroupNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// ListKeys lists the account keys for the specified Cognitive Services account.
//
// resourceGroupName is the name of the resource group within the user's
// subscription. accountName is the name of the cognitive services account
// within the specified resource group. Congitive Services account names must
// be between 3 and 24 characters in length and use numbers and lower-case
// letters only.
// resourceGroupName is the name of the resource group within the user's subscription. accountName is the name of
// Cognitive Services account.
func (client AccountsClient) ListKeys(resourceGroupName string, accountName string) (result AccountKeys, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil},
{Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "ListKeys")
}
@@ -455,7 +572,7 @@ func (client AccountsClient) ListKeysPreparer(resourceGroupName string, accountN
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-02-01-preview"
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -489,16 +606,13 @@ func (client AccountsClient) ListKeysResponder(resp *http.Response) (result Acco
// ListSkus list available SKUs for the requested Cognitive Services account
//
// resourceGroupName is the name of the resource group within the user's
// subscription. accountName is the name of the cognitive services account
// within the specified resource group. Cognitive Services account names must
// be between 3 and 24 characters in length and use numbers and lower-case
// letters only.
// resourceGroupName is the name of the resource group within the user's subscription. accountName is the name of
// Cognitive Services account.
func (client AccountsClient) ListSkus(resourceGroupName string, accountName string) (result AccountEnumerateSkusResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil},
{Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "ListSkus")
}
@@ -532,7 +646,7 @@ func (client AccountsClient) ListSkusPreparer(resourceGroupName string, accountN
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-02-01-preview"
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -564,24 +678,20 @@ func (client AccountsClient) ListSkusResponder(resp *http.Response) (result Acco
return
}
// RegenerateKey regenerates the specified account key for the specified
// Cognitive Services account.
// RegenerateKey regenerates the specified account key for the specified Cognitive Services account.
//
// resourceGroupName is the name of the resource group within the user's
// subscription. accountName is the name of the cognitive services account
// within the specified resource group. Cognitive Services account names must
// be between 3 and 24 characters in length and use numbers and lower-case
// letters only. body is regenerate key parameters.
func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, body RegenerateKeyParameters) (result AccountKeys, err error) {
// resourceGroupName is the name of the resource group within the user's subscription. accountName is the name of
// Cognitive Services account. parameters is regenerate key parameters.
func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, parameters RegenerateKeyParameters) (result AccountKeys, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil},
{Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "RegenerateKey")
}
req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, body)
req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "RegenerateKey", nil, "Failure preparing request")
return
@@ -603,14 +713,14 @@ func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName
}
// RegenerateKeyPreparer prepares the RegenerateKey request.
func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, body RegenerateKeyParameters) (*http.Request, error) {
func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, parameters RegenerateKeyParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"accountName": autorest.Encode("path", accountName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-02-01-preview"
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -620,7 +730,7 @@ func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, acc
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey", pathParameters),
autorest.WithJSON(body),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
@@ -646,21 +756,18 @@ func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result
// Update updates a Cognitive Services account
//
// resourceGroupName is the name of the resource group within the user's
// subscription. accountName is the name of the cognitive services account
// within the specified resource group. Cognitive Services account names must
// be between 3 and 24 characters in length and use numbers and lower-case
// letters only. body is the parameters to provide for the created account.
func (client AccountsClient) Update(resourceGroupName string, accountName string, body AccountUpdateParameters) (result Account, err error) {
// resourceGroupName is the name of the resource group within the user's subscription. accountName is the name of
// Cognitive Services account. parameters is the parameters to provide for the created account.
func (client AccountsClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil},
{Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "Update")
}
req, err := client.UpdatePreparer(resourceGroupName, accountName, body)
req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Update", nil, "Failure preparing request")
return
@@ -682,14 +789,14 @@ func (client AccountsClient) Update(resourceGroupName string, accountName string
}
// UpdatePreparer prepares the Update request.
func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountName string, body AccountUpdateParameters) (*http.Request, error) {
func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"accountName": autorest.Encode("path", accountName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-02-01-preview"
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -699,7 +806,7 @@ func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountNam
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters),
autorest.WithJSON(body),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
@@ -0,0 +1,113 @@
package cognitiveservices
// 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/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// CheckSkuAvailabilityClient is the cognitive Services Management Client
type CheckSkuAvailabilityClient struct {
ManagementClient
}
// NewCheckSkuAvailabilityClient creates an instance of the CheckSkuAvailabilityClient client.
func NewCheckSkuAvailabilityClient(subscriptionID string) CheckSkuAvailabilityClient {
return NewCheckSkuAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewCheckSkuAvailabilityClientWithBaseURI creates an instance of the CheckSkuAvailabilityClient client.
func NewCheckSkuAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) CheckSkuAvailabilityClient {
return CheckSkuAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List check available SKUs.
//
// location is resource location. parameters is check SKU Availablity POST body.
func (client CheckSkuAvailabilityClient) List(location string, parameters CheckSkuAvailabilityParameter) (result CheckSkuAvailabilityResultList, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Skus", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cognitiveservices.CheckSkuAvailabilityClient", "List")
}
req, err := client.ListPreparer(location, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "cognitiveservices.CheckSkuAvailabilityClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cognitiveservices.CheckSkuAvailabilityClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cognitiveservices.CheckSkuAvailabilityClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client CheckSkuAvailabilityClient) ListPreparer(location string, parameters CheckSkuAvailabilityParameter) (*http.Request, error) {
pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client CheckSkuAvailabilityClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client CheckSkuAvailabilityClient) ListResponder(resp *http.Response) (result CheckSkuAvailabilityResultList, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+3 -5
View File
@@ -1,5 +1,4 @@
// Package cognitiveservices implements the Azure ARM Cognitiveservices service
// API version 2016-02-01-preview.
// Package cognitiveservices implements the Azure ARM Cognitiveservices service API version 2017-04-18.
//
// Cognitive Services Management Client
package cognitiveservices
@@ -18,9 +17,8 @@ package cognitiveservices
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// 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"
+86 -13
View File
@@ -14,12 +14,13 @@ package cognitiveservices
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// 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/to"
"net/http"
)
// KeyName enumerates the values for key name.
@@ -50,6 +51,8 @@ const (
ComputerVision Kind = "ComputerVision"
// ContentModerator specifies the content moderator state for kind.
ContentModerator Kind = "ContentModerator"
// CustomSpeech specifies the custom speech state for kind.
CustomSpeech Kind = "CustomSpeech"
// Emotion specifies the emotion state for kind.
Emotion Kind = "Emotion"
// Face specifies the face state for kind.
@@ -126,8 +129,8 @@ const (
Standard SkuTier = "Standard"
)
// Account is cognitive Services Account is an Azure resource representing the
// provisioned account, its type, location and SKU.
// Account is cognitive Services Account is an Azure resource representing the provisioned account, its type, location
// and SKU.
type Account struct {
autorest.Response `json:"-"`
Etag *string `json:"etag,omitempty"`
@@ -150,8 +153,7 @@ type AccountCreateParameters struct {
Properties *map[string]interface{} `json:"properties,omitempty"`
}
// AccountEnumerateSkusResult is the list of cognitive services accounts
// operation response.
// AccountEnumerateSkusResult is the list of cognitive services accounts operation response.
type AccountEnumerateSkusResult struct {
autorest.Response `json:"-"`
Value *[]ResourceAndSku `json:"value,omitempty"`
@@ -164,17 +166,30 @@ type AccountKeys struct {
Key2 *string `json:"key2,omitempty"`
}
// AccountListResult is the list of cognitive services accounts operation
// response.
// AccountListResult is the list of cognitive services accounts operation response.
type AccountListResult struct {
autorest.Response `json:"-"`
NextLink *string `json:"nextLink,omitempty"`
Value *[]Account `json:"value,omitempty"`
}
// AccountProperties is
// AccountListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client AccountListResult) AccountListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// AccountProperties is properties of Cognitive Services account.
type AccountProperties struct {
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
Endpoint *string `json:"endpoint,omitempty"`
InternalID *string `json:"internalId,omitempty"`
}
// AccountUpdateParameters is the parameters to provide for the account.
@@ -183,23 +198,81 @@ type AccountUpdateParameters struct {
Tags *map[string]*string `json:"tags,omitempty"`
}
// Error is
// CheckSkuAvailabilityParameter is check SKU availability parameter.
type CheckSkuAvailabilityParameter struct {
Skus *[]SkuName `json:"skus,omitempty"`
Kind Kind `json:"kind,omitempty"`
Type *string `json:"type,omitempty"`
}
// CheckSkuAvailabilityResult is check SKU availability result.
type CheckSkuAvailabilityResult struct {
Kind Kind `json:"kind,omitempty"`
Type *string `json:"type,omitempty"`
SkuName SkuName `json:"skuName,omitempty"`
SkuAvailable *bool `json:"skuAvailable,omitempty"`
Reason *string `json:"reason,omitempty"`
Message *string `json:"message,omitempty"`
}
// CheckSkuAvailabilityResultList is check SKU availability result list.
type CheckSkuAvailabilityResultList struct {
autorest.Response `json:"-"`
Value *[]CheckSkuAvailabilityResult `json:"value,omitempty"`
}
// Error is cognitive Services error object.
type Error struct {
Error *ErrorBody `json:"error,omitempty"`
}
// ErrorBody is
// ErrorBody is cognitive Services error body.
type ErrorBody struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// OperationDisplayInfo is the operation supported by Cognitive Services.
type OperationDisplayInfo struct {
Description *string `json:"description,omitempty"`
Operation *string `json:"operation,omitempty"`
Provider *string `json:"provider,omitempty"`
Resource *string `json:"resource,omitempty"`
}
// OperationEntity is the operation supported by Cognitive Services.
type OperationEntity struct {
Name *string `json:"name,omitempty"`
Display *OperationDisplayInfo `json:"display,omitempty"`
Origin *string `json:"origin,omitempty"`
Properties *map[string]interface{} `json:"properties,omitempty"`
}
// OperationEntityListResult is the list of cognitive services accounts operation response.
type OperationEntityListResult struct {
autorest.Response `json:"-"`
NextLink *string `json:"nextLink,omitempty"`
Value *[]OperationEntity `json:"value,omitempty"`
}
// OperationEntityListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client OperationEntityListResult) OperationEntityListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// RegenerateKeyParameters is regenerate key parameters.
type RegenerateKeyParameters struct {
KeyName KeyName `json:"keyName,omitempty"`
}
// ResourceAndSku is
// ResourceAndSku is cognitive Services resource type and SKU.
type ResourceAndSku struct {
ResourceType *string `json:"resourceType,omitempty"`
Sku *Sku `json:"sku,omitempty"`
@@ -0,0 +1,165 @@
package cognitiveservices
// 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/azure"
"net/http"
)
// OperationsClient is the cognitive Services Management Client
type OperationsClient struct {
ManagementClient
}
// NewOperationsClient creates an instance of the OperationsClient client.
func NewOperationsClient(subscriptionID string) OperationsClient {
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client.
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List lists all the available Cognitive Services account operations.
func (client OperationsClient) List() (result OperationEntityListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client OperationsClient) ListPreparer() (*http.Request, error) {
const APIVersion = "2017-04-18"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.CognitiveServices/operations"),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client OperationsClient) ListResponder(resp *http.Response) (result OperationEntityListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client OperationsClient) ListNextResults(lastResults OperationEntityListResult) (result OperationEntityListResult, err error) {
req, err := lastResults.OperationEntityListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListComplete gets all elements from the list without paging.
func (client OperationsClient) ListComplete(cancel <-chan struct{}) (<-chan OperationEntity, <-chan error) {
resultChan := make(chan OperationEntity)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
+4 -5
View File
@@ -14,16 +14,15 @@ package cognitiveservices
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// 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/v10.1.0-beta arm-cognitiveservices/2016-02-01-preview"
return "Azure-SDK-For-Go/v11.0.0-beta arm-cognitiveservices/2017-04-18"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.1.0-beta"
return "v11.0.0-beta"
}