diff --git a/services/botservice/mgmt/2021-03-01/botservice/CHANGELOG.md b/services/botservice/mgmt/2021-03-01/botservice/CHANGELOG.md new file mode 100644 index 000000000000..23b82d065568 --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased Content + diff --git a/services/botservice/mgmt/2021-03-01/botservice/_meta.json b/services/botservice/mgmt/2021-03-01/botservice/_meta.json new file mode 100644 index 000000000000..5dbeb47c0dd3 --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "e6ee3d4f6a29f081eddada399bd1cb373133af02", + "readme": "/_/azure-rest-api-specs/specification/botservice/resource-manager/readme.md", + "tag": "package-2021-03-01", + "use": "@microsoft.azure/autorest.go@2.1.180", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.180 --tag=package-2021-03-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/botservice/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/botservice/mgmt/2021-03-01/botservice/botconnection.go b/services/botservice/mgmt/2021-03-01/botservice/botconnection.go new file mode 100644 index 000000000000..a269ad980718 --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/botconnection.go @@ -0,0 +1,708 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" + "net/http" +) + +// BotConnectionClient is the azure Bot Service is a platform for creating smart conversational agents. +type BotConnectionClient struct { + BaseClient +} + +// NewBotConnectionClient creates an instance of the BotConnectionClient client. +func NewBotConnectionClient(subscriptionID string) BotConnectionClient { + return NewBotConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBotConnectionClientWithBaseURI creates an instance of the BotConnectionClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBotConnectionClientWithBaseURI(baseURI string, subscriptionID string) BotConnectionClient { + return BotConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create register a new Auth Connection for a Bot Service +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// connectionName - the name of the Bot Service Connection Setting resource. +// parameters - the parameters to provide for creating the Connection Setting. +func (client BotConnectionClient) Create(ctx context.Context, resourceGroupName string, resourceName string, connectionName string, parameters ConnectionSetting) (result ConnectionSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.Create") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: connectionName, + Constraints: []validation.Constraint{{Target: "connectionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "connectionName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "connectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.BotConnectionClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, connectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client BotConnectionClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, connectionName string, parameters ConnectionSetting) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client BotConnectionClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client BotConnectionClient) CreateResponder(resp *http.Response) (result ConnectionSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Connection Setting registration for a Bot Service +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// connectionName - the name of the Bot Service Connection Setting resource. +func (client BotConnectionClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: connectionName, + Constraints: []validation.Constraint{{Target: "connectionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "connectionName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "connectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.BotConnectionClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BotConnectionClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BotConnectionClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BotConnectionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a Connection Setting registration for a Bot Service +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// connectionName - the name of the Bot Service Connection Setting resource. +func (client BotConnectionClient) Get(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (result ConnectionSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.Get") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: connectionName, + Constraints: []validation.Constraint{{Target: "connectionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "connectionName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "connectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.BotConnectionClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BotConnectionClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BotConnectionClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BotConnectionClient) GetResponder(resp *http.Response) (result ConnectionSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBotService returns all the Connection Settings registered to a particular BotService resource +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +func (client BotConnectionClient) ListByBotService(ctx context.Context, resourceGroupName string, resourceName string) (result ConnectionSettingResponseListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.ListByBotService") + defer func() { + sc := -1 + if result.csrl.Response.Response != nil { + sc = result.csrl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.BotConnectionClient", "ListByBotService", err.Error()) + } + + result.fn = client.listByBotServiceNextResults + req, err := client.ListByBotServicePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListByBotService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBotServiceSender(req) + if err != nil { + result.csrl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListByBotService", resp, "Failure sending request") + return + } + + result.csrl, err = client.ListByBotServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListByBotService", resp, "Failure responding to request") + return + } + if result.csrl.hasNextLink() && result.csrl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByBotServicePreparer prepares the ListByBotService request. +func (client BotConnectionClient) ListByBotServicePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBotServiceSender sends the ListByBotService request. The method will close the +// http.Response Body if it receives an error. +func (client BotConnectionClient) ListByBotServiceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByBotServiceResponder handles the response to the ListByBotService request. The method always +// closes the http.Response Body. +func (client BotConnectionClient) ListByBotServiceResponder(resp *http.Response) (result ConnectionSettingResponseList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBotServiceNextResults retrieves the next set of results, if any. +func (client BotConnectionClient) listByBotServiceNextResults(ctx context.Context, lastResults ConnectionSettingResponseList) (result ConnectionSettingResponseList, err error) { + req, err := lastResults.connectionSettingResponseListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "listByBotServiceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBotServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "listByBotServiceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBotServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "listByBotServiceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBotServiceComplete enumerates all values, automatically crossing page boundaries as required. +func (client BotConnectionClient) ListByBotServiceComplete(ctx context.Context, resourceGroupName string, resourceName string) (result ConnectionSettingResponseListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.ListByBotService") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBotService(ctx, resourceGroupName, resourceName) + return +} + +// ListServiceProviders lists the available Service Providers for creating Connection Settings +func (client BotConnectionClient) ListServiceProviders(ctx context.Context) (result ServiceProviderResponseList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.ListServiceProviders") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListServiceProvidersPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListServiceProviders", nil, "Failure preparing request") + return + } + + resp, err := client.ListServiceProvidersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListServiceProviders", resp, "Failure sending request") + return + } + + result, err = client.ListServiceProvidersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListServiceProviders", resp, "Failure responding to request") + return + } + + return +} + +// ListServiceProvidersPreparer prepares the ListServiceProviders request. +func (client BotConnectionClient) ListServiceProvidersPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListServiceProvidersSender sends the ListServiceProviders request. The method will close the +// http.Response Body if it receives an error. +func (client BotConnectionClient) ListServiceProvidersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListServiceProvidersResponder handles the response to the ListServiceProviders request. The method always +// closes the http.Response Body. +func (client BotConnectionClient) ListServiceProvidersResponder(resp *http.Response) (result ServiceProviderResponseList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWithSecrets get a Connection Setting registration for a Bot Service +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// connectionName - the name of the Bot Service Connection Setting resource. +func (client BotConnectionClient) ListWithSecrets(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (result ConnectionSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.ListWithSecrets") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: connectionName, + Constraints: []validation.Constraint{{Target: "connectionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "connectionName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "connectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.BotConnectionClient", "ListWithSecrets", err.Error()) + } + + req, err := client.ListWithSecretsPreparer(ctx, resourceGroupName, resourceName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListWithSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.ListWithSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListWithSecrets", resp, "Failure sending request") + return + } + + result, err = client.ListWithSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListWithSecrets", resp, "Failure responding to request") + return + } + + return +} + +// ListWithSecretsPreparer prepares the ListWithSecrets request. +func (client BotConnectionClient) ListWithSecretsPreparer(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWithSecretsSender sends the ListWithSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client BotConnectionClient) ListWithSecretsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWithSecretsResponder handles the response to the ListWithSecrets request. The method always +// closes the http.Response Body. +func (client BotConnectionClient) ListWithSecretsResponder(resp *http.Response) (result ConnectionSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a Connection Setting registration for a Bot Service +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// connectionName - the name of the Bot Service Connection Setting resource. +// parameters - the parameters to provide for updating the Connection Setting. +func (client BotConnectionClient) Update(ctx context.Context, resourceGroupName string, resourceName string, connectionName string, parameters ConnectionSetting) (result ConnectionSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.Update") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: connectionName, + Constraints: []validation.Constraint{{Target: "connectionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "connectionName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "connectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.BotConnectionClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, connectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BotConnectionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, connectionName string, parameters ConnectionSetting) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BotConnectionClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BotConnectionClient) UpdateResponder(resp *http.Response) (result ConnectionSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/botservice/mgmt/2021-03-01/botservice/bots.go b/services/botservice/mgmt/2021-03-01/botservice/bots.go new file mode 100644 index 000000000000..816f40f5dcc3 --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/bots.go @@ -0,0 +1,703 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" + "net/http" +) + +// BotsClient is the azure Bot Service is a platform for creating smart conversational agents. +type BotsClient struct { + BaseClient +} + +// NewBotsClient creates an instance of the BotsClient client. +func NewBotsClient(subscriptionID string) BotsClient { + return NewBotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBotsClientWithBaseURI creates an instance of the BotsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBotsClientWithBaseURI(baseURI string, subscriptionID string) BotsClient { + return BotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a Bot Service. Bot Service is a resource group wide resource type. +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// parameters - the parameters to provide for the created bot. +func (client BotsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, parameters Bot) (result Bot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotsClient.Create") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties.Endpoint", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties.MsaAppID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("botservice.BotsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client BotsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters Bot) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client BotsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client BotsClient) CreateResponder(resp *http.Response) (result Bot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Bot Service from the resource group. +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +func (client BotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.BotsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BotsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a BotService specified by the parameters. +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +func (client BotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Bot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotsClient.Get") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.BotsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BotsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BotsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BotsClient) GetResponder(resp *http.Response) (result Bot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCheckNameAvailability check whether a bot name is available. +// Parameters: +// parameters - the request body parameters to provide for the check name availability request +func (client BotsClient) GetCheckNameAvailability(ctx context.Context, parameters CheckNameAvailabilityRequestBody) (result CheckNameAvailabilityResponseBody, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotsClient.GetCheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetCheckNameAvailabilityPreparer(ctx, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "GetCheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.GetCheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "GetCheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.GetCheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "GetCheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// GetCheckNameAvailabilityPreparer prepares the GetCheckNameAvailability request. +func (client BotsClient) GetCheckNameAvailabilityPreparer(ctx context.Context, parameters CheckNameAvailabilityRequestBody) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.BotService/checkNameAvailability"), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCheckNameAvailabilitySender sends the GetCheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BotsClient) GetCheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetCheckNameAvailabilityResponder handles the response to the GetCheckNameAvailability request. The method always +// closes the http.Response Body. +func (client BotsClient) GetCheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResponseBody, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns all the resources of a particular type belonging to a subscription. +func (client BotsClient) List(ctx context.Context) (result BotResponseListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotsClient.List") + defer func() { + sc := -1 + if result.brl.Response.Response != nil { + sc = result.brl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.brl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "List", resp, "Failure sending request") + return + } + + result.brl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "List", resp, "Failure responding to request") + return + } + if result.brl.hasNextLink() && result.brl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BotsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BotsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BotsClient) ListResponder(resp *http.Response) (result BotResponseList, err error) { + err = autorest.Respond( + resp, + 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 BotsClient) listNextResults(ctx context.Context, lastResults BotResponseList) (result BotResponseList, err error) { + req, err := lastResults.botResponseListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "botservice.BotsClient", "listNextResults", 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, "botservice.BotsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BotsClient) ListComplete(ctx context.Context) (result BotResponseListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup returns all the resources of a particular type belonging to a resource group +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +func (client BotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result BotResponseListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.brl.Response.Response != nil { + sc = result.brl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.BotsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.brl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.brl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.brl.hasNextLink() && result.brl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client BotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client BotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client BotsClient) ListByResourceGroupResponder(resp *http.Response) (result BotResponseList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client BotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults BotResponseList) (result BotResponseList, err error) { + req, err := lastResults.botResponseListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "botservice.BotsClient", "listByResourceGroupNextResults", 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, "botservice.BotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client BotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result BotResponseListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update updates a Bot Service +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// parameters - the parameters to provide for the created bot. +func (client BotsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, parameters Bot) (result Bot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotsClient.Update") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.BotsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.BotsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BotsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters Bot) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BotsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BotsClient) UpdateResponder(resp *http.Response) (result Bot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/botservice/mgmt/2021-03-01/botservice/botserviceapi/interfaces.go b/services/botservice/mgmt/2021-03-01/botservice/botserviceapi/interfaces.go new file mode 100644 index 000000000000..1e8b1b01957b --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/botserviceapi/interfaces.go @@ -0,0 +1,77 @@ +package botserviceapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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/botservice/mgmt/2021-03-01/botservice" + "github.com/Azure/go-autorest/autorest" +) + +// BotsClientAPI contains the set of methods on the BotsClient type. +type BotsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, parameters botservice.Bot) (result botservice.Bot, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result botservice.Bot, err error) + GetCheckNameAvailability(ctx context.Context, parameters botservice.CheckNameAvailabilityRequestBody) (result botservice.CheckNameAvailabilityResponseBody, err error) + List(ctx context.Context) (result botservice.BotResponseListPage, err error) + ListComplete(ctx context.Context) (result botservice.BotResponseListIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result botservice.BotResponseListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result botservice.BotResponseListIterator, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, parameters botservice.Bot) (result botservice.Bot, err error) +} + +var _ BotsClientAPI = (*botservice.BotsClient)(nil) + +// ChannelsClientAPI contains the set of methods on the ChannelsClient type. +type ChannelsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, channelName botservice.ChannelName, parameters botservice.BotChannel) (result botservice.BotChannel, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, channelName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, channelName string) (result botservice.BotChannel, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, resourceName string) (result botservice.ChannelResponseListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, resourceName string) (result botservice.ChannelResponseListIterator, err error) + ListWithKeys(ctx context.Context, resourceGroupName string, resourceName string, channelName botservice.ChannelName) (result botservice.BotChannel, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, channelName botservice.ChannelName, parameters botservice.BotChannel) (result botservice.BotChannel, err error) +} + +var _ ChannelsClientAPI = (*botservice.ChannelsClient)(nil) + +// DirectLineClientAPI contains the set of methods on the DirectLineClient type. +type DirectLineClientAPI interface { + RegenerateKeys(ctx context.Context, resourceGroupName string, resourceName string, channelName botservice.RegenerateKeysChannelName, parameters botservice.SiteInfo) (result botservice.BotChannel, err error) +} + +var _ DirectLineClientAPI = (*botservice.DirectLineClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result botservice.OperationEntityListResultPage, err error) + ListComplete(ctx context.Context) (result botservice.OperationEntityListResultIterator, err error) +} + +var _ OperationsClientAPI = (*botservice.OperationsClient)(nil) + +// BotConnectionClientAPI contains the set of methods on the BotConnectionClient type. +type BotConnectionClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, connectionName string, parameters botservice.ConnectionSetting) (result botservice.ConnectionSetting, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (result botservice.ConnectionSetting, err error) + ListByBotService(ctx context.Context, resourceGroupName string, resourceName string) (result botservice.ConnectionSettingResponseListPage, err error) + ListByBotServiceComplete(ctx context.Context, resourceGroupName string, resourceName string) (result botservice.ConnectionSettingResponseListIterator, err error) + ListServiceProviders(ctx context.Context) (result botservice.ServiceProviderResponseList, err error) + ListWithSecrets(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (result botservice.ConnectionSetting, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, connectionName string, parameters botservice.ConnectionSetting) (result botservice.ConnectionSetting, err error) +} + +var _ BotConnectionClientAPI = (*botservice.BotConnectionClient)(nil) + +// HostSettingsClientAPI contains the set of methods on the HostSettingsClient type. +type HostSettingsClientAPI interface { + Get(ctx context.Context) (result botservice.HostSettingsResponse, err error) +} + +var _ HostSettingsClientAPI = (*botservice.HostSettingsClient)(nil) diff --git a/services/botservice/mgmt/2021-03-01/botservice/channels.go b/services/botservice/mgmt/2021-03-01/botservice/channels.go new file mode 100644 index 000000000000..729c76d49c3d --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/channels.go @@ -0,0 +1,625 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" + "net/http" +) + +// ChannelsClient is the azure Bot Service is a platform for creating smart conversational agents. +type ChannelsClient struct { + BaseClient +} + +// NewChannelsClient creates an instance of the ChannelsClient client. +func NewChannelsClient(subscriptionID string) ChannelsClient { + return NewChannelsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewChannelsClientWithBaseURI creates an instance of the ChannelsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewChannelsClientWithBaseURI(baseURI string, subscriptionID string) ChannelsClient { + return ChannelsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a Channel registration for a Bot Service +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// channelName - the name of the Channel resource. +// parameters - the parameters to provide for the created bot. +func (client ChannelsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, channelName ChannelName, parameters BotChannel) (result BotChannel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelsClient.Create") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.ChannelsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, channelName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ChannelsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, channelName ChannelName, parameters BotChannel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "channelName": autorest.Encode("path", channelName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ChannelsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ChannelsClient) CreateResponder(resp *http.Response) (result BotChannel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Channel registration from a Bot Service +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// channelName - the name of the Bot resource. +func (client ChannelsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, channelName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: channelName, + Constraints: []validation.Constraint{{Target: "channelName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "channelName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "channelName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.ChannelsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, channelName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ChannelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, channelName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "channelName": autorest.Encode("path", channelName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ChannelsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ChannelsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a BotService Channel registration specified by the parameters. +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// channelName - the name of the Bot resource. +func (client ChannelsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, channelName string) (result BotChannel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelsClient.Get") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: channelName, + Constraints: []validation.Constraint{{Target: "channelName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "channelName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "channelName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.ChannelsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, channelName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ChannelsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, channelName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "channelName": autorest.Encode("path", channelName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ChannelsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ChannelsClient) GetResponder(resp *http.Response) (result BotChannel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup returns all the Channel registrations of a particular BotService resource +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +func (client ChannelsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, resourceName string) (result ChannelResponseListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.crl.Response.Response != nil { + sc = result.crl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.ChannelsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.crl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.crl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.crl.hasNextLink() && result.crl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ChannelsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ChannelsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ChannelsClient) ListByResourceGroupResponder(resp *http.Response) (result ChannelResponseList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ChannelsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ChannelResponseList) (result ChannelResponseList, err error) { + req, err := lastResults.channelResponseListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "botservice.ChannelsClient", "listByResourceGroupNextResults", 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, "botservice.ChannelsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ChannelsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, resourceName string) (result ChannelResponseListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, resourceName) + return +} + +// ListWithKeys lists a Channel registration for a Bot Service including secrets +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// channelName - the name of the Channel resource. +func (client ChannelsClient) ListWithKeys(ctx context.Context, resourceGroupName string, resourceName string, channelName ChannelName) (result BotChannel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelsClient.ListWithKeys") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.ChannelsClient", "ListWithKeys", err.Error()) + } + + req, err := client.ListWithKeysPreparer(ctx, resourceGroupName, resourceName, channelName) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "ListWithKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListWithKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "ListWithKeys", resp, "Failure sending request") + return + } + + result, err = client.ListWithKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "ListWithKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListWithKeysPreparer prepares the ListWithKeys request. +func (client ChannelsClient) ListWithKeysPreparer(ctx context.Context, resourceGroupName string, resourceName string, channelName ChannelName) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "channelName": autorest.Encode("path", channelName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListWithKeysSender sends the ListWithKeys request. The method will close the +// http.Response Body if it receives an error. +func (client ChannelsClient) ListWithKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListWithKeysResponder handles the response to the ListWithKeys request. The method always +// closes the http.Response Body. +func (client ChannelsClient) ListWithKeysResponder(resp *http.Response) (result BotChannel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a Channel registration for a Bot Service +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// channelName - the name of the Channel resource. +// parameters - the parameters to provide for the created bot. +func (client ChannelsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, channelName ChannelName, parameters BotChannel) (result BotChannel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelsClient.Update") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.ChannelsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, channelName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.ChannelsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ChannelsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, channelName ChannelName, parameters BotChannel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "channelName": autorest.Encode("path", channelName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ChannelsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ChannelsClient) UpdateResponder(resp *http.Response) (result BotChannel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/botservice/mgmt/2021-03-01/botservice/client.go b/services/botservice/mgmt/2021-03-01/botservice/client.go new file mode 100644 index 000000000000..52f4225069f7 --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/client.go @@ -0,0 +1,41 @@ +// Package botservice implements the Azure ARM Botservice service API version 2021-03-01. +// +// Azure Bot Service is a platform for creating smart conversational agents. +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" +) + +const ( + // DefaultBaseURI is the default URI used for the service Botservice + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Botservice. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/botservice/mgmt/2021-03-01/botservice/directline.go b/services/botservice/mgmt/2021-03-01/botservice/directline.go new file mode 100644 index 000000000000..9adb6866ef56 --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/directline.go @@ -0,0 +1,128 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" + "net/http" +) + +// DirectLineClient is the azure Bot Service is a platform for creating smart conversational agents. +type DirectLineClient struct { + BaseClient +} + +// NewDirectLineClient creates an instance of the DirectLineClient client. +func NewDirectLineClient(subscriptionID string) DirectLineClient { + return NewDirectLineClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDirectLineClientWithBaseURI creates an instance of the DirectLineClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDirectLineClientWithBaseURI(baseURI string, subscriptionID string) DirectLineClient { + return DirectLineClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// RegenerateKeys regenerates secret keys and returns them for the DirectLine Channel of a particular BotService +// resource +// Parameters: +// resourceGroupName - the name of the Bot resource group in the user subscription. +// resourceName - the name of the Bot resource. +// channelName - the name of the Channel resource for which keys are to be regenerated. +// parameters - the parameters to provide for the created bot. +func (client DirectLineClient) RegenerateKeys(ctx context.Context, resourceGroupName string, resourceName string, channelName RegenerateKeysChannelName, parameters SiteInfo) (result BotChannel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DirectLineClient.RegenerateKeys") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SiteName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("botservice.DirectLineClient", "RegenerateKeys", err.Error()) + } + + req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, resourceName, channelName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.DirectLineClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.DirectLineClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.DirectLineClient", "RegenerateKeys", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client DirectLineClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, resourceName string, channelName RegenerateKeysChannelName, parameters SiteInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "channelName": autorest.Encode("path", channelName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client DirectLineClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client DirectLineClient) RegenerateKeysResponder(resp *http.Response) (result BotChannel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/botservice/mgmt/2021-03-01/botservice/enums.go b/services/botservice/mgmt/2021-03-01/botservice/enums.go new file mode 100644 index 000000000000..61e370410440 --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/enums.go @@ -0,0 +1,164 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ChannelName enumerates the values for channel name. +type ChannelName string + +const ( + // ChannelNameAlexaChannel ... + ChannelNameAlexaChannel ChannelName = "AlexaChannel" + // ChannelNameDirectLineChannel ... + ChannelNameDirectLineChannel ChannelName = "DirectLineChannel" + // ChannelNameDirectLineSpeechChannel ... + ChannelNameDirectLineSpeechChannel ChannelName = "DirectLineSpeechChannel" + // ChannelNameEmailChannel ... + ChannelNameEmailChannel ChannelName = "EmailChannel" + // ChannelNameFacebookChannel ... + ChannelNameFacebookChannel ChannelName = "FacebookChannel" + // ChannelNameKikChannel ... + ChannelNameKikChannel ChannelName = "KikChannel" + // ChannelNameLineChannel ... + ChannelNameLineChannel ChannelName = "LineChannel" + // ChannelNameMsTeamsChannel ... + ChannelNameMsTeamsChannel ChannelName = "MsTeamsChannel" + // ChannelNameSkypeChannel ... + ChannelNameSkypeChannel ChannelName = "SkypeChannel" + // ChannelNameSlackChannel ... + ChannelNameSlackChannel ChannelName = "SlackChannel" + // ChannelNameSmsChannel ... + ChannelNameSmsChannel ChannelName = "SmsChannel" + // ChannelNameTelegramChannel ... + ChannelNameTelegramChannel ChannelName = "TelegramChannel" + // ChannelNameWebChatChannel ... + ChannelNameWebChatChannel ChannelName = "WebChatChannel" +) + +// PossibleChannelNameValues returns an array of possible values for the ChannelName const type. +func PossibleChannelNameValues() []ChannelName { + return []ChannelName{ChannelNameAlexaChannel, ChannelNameDirectLineChannel, ChannelNameDirectLineSpeechChannel, ChannelNameEmailChannel, ChannelNameFacebookChannel, ChannelNameKikChannel, ChannelNameLineChannel, ChannelNameMsTeamsChannel, ChannelNameSkypeChannel, ChannelNameSlackChannel, ChannelNameSmsChannel, ChannelNameTelegramChannel, ChannelNameWebChatChannel} +} + +// ChannelNameBasicChannel enumerates the values for channel name basic channel. +type ChannelNameBasicChannel string + +const ( + // ChannelNameAlexaChannel1 ... + ChannelNameAlexaChannel1 ChannelNameBasicChannel = "AlexaChannel" + // ChannelNameChannel ... + ChannelNameChannel ChannelNameBasicChannel = "Channel" + // ChannelNameDirectLineChannel1 ... + ChannelNameDirectLineChannel1 ChannelNameBasicChannel = "DirectLineChannel" + // ChannelNameDirectLineSpeechChannel1 ... + ChannelNameDirectLineSpeechChannel1 ChannelNameBasicChannel = "DirectLineSpeechChannel" + // ChannelNameEmailChannel1 ... + ChannelNameEmailChannel1 ChannelNameBasicChannel = "EmailChannel" + // ChannelNameFacebookChannel1 ... + ChannelNameFacebookChannel1 ChannelNameBasicChannel = "FacebookChannel" + // ChannelNameKikChannel1 ... + ChannelNameKikChannel1 ChannelNameBasicChannel = "KikChannel" + // ChannelNameLineChannel1 ... + ChannelNameLineChannel1 ChannelNameBasicChannel = "LineChannel" + // ChannelNameMsTeamsChannel1 ... + ChannelNameMsTeamsChannel1 ChannelNameBasicChannel = "MsTeamsChannel" + // ChannelNameSkypeChannel1 ... + ChannelNameSkypeChannel1 ChannelNameBasicChannel = "SkypeChannel" + // ChannelNameSlackChannel1 ... + ChannelNameSlackChannel1 ChannelNameBasicChannel = "SlackChannel" + // ChannelNameSmsChannel1 ... + ChannelNameSmsChannel1 ChannelNameBasicChannel = "SmsChannel" + // ChannelNameTelegramChannel1 ... + ChannelNameTelegramChannel1 ChannelNameBasicChannel = "TelegramChannel" + // ChannelNameWebChatChannel1 ... + ChannelNameWebChatChannel1 ChannelNameBasicChannel = "WebChatChannel" +) + +// PossibleChannelNameBasicChannelValues returns an array of possible values for the ChannelNameBasicChannel const type. +func PossibleChannelNameBasicChannelValues() []ChannelNameBasicChannel { + return []ChannelNameBasicChannel{ChannelNameAlexaChannel1, ChannelNameChannel, ChannelNameDirectLineChannel1, ChannelNameDirectLineSpeechChannel1, ChannelNameEmailChannel1, ChannelNameFacebookChannel1, ChannelNameKikChannel1, ChannelNameLineChannel1, ChannelNameMsTeamsChannel1, ChannelNameSkypeChannel1, ChannelNameSlackChannel1, ChannelNameSmsChannel1, ChannelNameTelegramChannel1, ChannelNameWebChatChannel1} +} + +// Key enumerates the values for key. +type Key string + +const ( + // Key1 ... + Key1 Key = "key1" + // Key2 ... + Key2 Key = "key2" +) + +// PossibleKeyValues returns an array of possible values for the Key const type. +func PossibleKeyValues() []Key { + return []Key{Key1, Key2} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // KindAzurebot ... + KindAzurebot Kind = "azurebot" + // KindBot ... + KindBot Kind = "bot" + // KindDesigner ... + KindDesigner Kind = "designer" + // KindFunction ... + KindFunction Kind = "function" + // KindSdk ... + KindSdk Kind = "sdk" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindAzurebot, KindBot, KindDesigner, KindFunction, KindSdk} +} + +// RegenerateKeysChannelName enumerates the values for regenerate keys channel name. +type RegenerateKeysChannelName string + +const ( + // RegenerateKeysChannelNameDirectLineChannel ... + RegenerateKeysChannelNameDirectLineChannel RegenerateKeysChannelName = "DirectLineChannel" + // RegenerateKeysChannelNameWebChatChannel ... + RegenerateKeysChannelNameWebChatChannel RegenerateKeysChannelName = "WebChatChannel" +) + +// PossibleRegenerateKeysChannelNameValues returns an array of possible values for the RegenerateKeysChannelName const type. +func PossibleRegenerateKeysChannelNameValues() []RegenerateKeysChannelName { + return []RegenerateKeysChannelName{RegenerateKeysChannelNameDirectLineChannel, RegenerateKeysChannelNameWebChatChannel} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // F0 ... + F0 SkuName = "F0" + // S1 ... + S1 SkuName = "S1" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{F0, S1} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Free ... + Free SkuTier = "Free" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Free, Standard} +} diff --git a/services/botservice/mgmt/2021-03-01/botservice/hostsettings.go b/services/botservice/mgmt/2021-03-01/botservice/hostsettings.go new file mode 100644 index 000000000000..29fe2eb1b950 --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/hostsettings.go @@ -0,0 +1,102 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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/tracing" + "net/http" +) + +// HostSettingsClient is the azure Bot Service is a platform for creating smart conversational agents. +type HostSettingsClient struct { + BaseClient +} + +// NewHostSettingsClient creates an instance of the HostSettingsClient client. +func NewHostSettingsClient(subscriptionID string) HostSettingsClient { + return NewHostSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewHostSettingsClientWithBaseURI creates an instance of the HostSettingsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewHostSettingsClientWithBaseURI(baseURI string, subscriptionID string) HostSettingsClient { + return HostSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get per subscription settings needed to host bot in compute resource such as Azure App Service +func (client HostSettingsClient) Get(ctx context.Context) (result HostSettingsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HostSettingsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.HostSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.HostSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.HostSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client HostSettingsClient) GetPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client HostSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client HostSettingsClient) GetResponder(resp *http.Response) (result HostSettingsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/botservice/mgmt/2021-03-01/botservice/models.go b/services/botservice/mgmt/2021-03-01/botservice/models.go new file mode 100644 index 000000000000..147969c2df4d --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/models.go @@ -0,0 +1,3061 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/botservice/mgmt/2021-03-01/botservice" + +// AlexaChannel alexa channel definition +type AlexaChannel struct { + // Properties - The set of properties specific to Alexa channel resource + Properties *AlexaChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlexaChannel. +func (ac AlexaChannel) MarshalJSON() ([]byte, error) { + ac.ChannelName = ChannelNameAlexaChannel1 + objectMap := make(map[string]interface{}) + if ac.Properties != nil { + objectMap["properties"] = ac.Properties + } + if ac.ChannelName != "" { + objectMap["channelName"] = ac.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return &ac, true +} + +// AsFacebookChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for AlexaChannel. +func (ac AlexaChannel) AsBasicChannel() (BasicChannel, bool) { + return &ac, true +} + +// AlexaChannelProperties the parameters to provide for the Alexa channel. +type AlexaChannelProperties struct { + // AlexaSkillID - The Alexa skill Id + AlexaSkillID *string `json:"alexaSkillId,omitempty"` + // URLFragment - READ-ONLY; Url fragment used in part of the Uri configured in Alexa + URLFragment *string `json:"urlFragment,omitempty"` + // ServiceEndpointURI - READ-ONLY; Full Uri used to configured the skill in Alexa + ServiceEndpointURI *string `json:"serviceEndpointUri,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlexaChannelProperties. +func (acp AlexaChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if acp.AlexaSkillID != nil { + objectMap["alexaSkillId"] = acp.AlexaSkillID + } + if acp.IsEnabled != nil { + objectMap["isEnabled"] = acp.IsEnabled + } + return json.Marshal(objectMap) +} + +// Bot bot resource definition +type Bot struct { + autorest.Response `json:"-"` + // Properties - The set of properties specific to bot resource + Properties *BotProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - Gets or sets the SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' + Kind Kind `json:"kind,omitempty"` + // Etag - Entity Tag + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Bot. +func (b Bot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if b.Properties != nil { + objectMap["properties"] = b.Properties + } + if b.Location != nil { + objectMap["location"] = b.Location + } + if b.Tags != nil { + objectMap["tags"] = b.Tags + } + if b.Sku != nil { + objectMap["sku"] = b.Sku + } + if b.Kind != "" { + objectMap["kind"] = b.Kind + } + if b.Etag != nil { + objectMap["etag"] = b.Etag + } + return json.Marshal(objectMap) +} + +// BotChannel bot channel resource definition +type BotChannel struct { + autorest.Response `json:"-"` + // Properties - The set of properties specific to bot channel resource + Properties BasicChannel `json:"properties,omitempty"` + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - Gets or sets the SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' + Kind Kind `json:"kind,omitempty"` + // Etag - Entity Tag + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for BotChannel. +func (bc BotChannel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = bc.Properties + if bc.Location != nil { + objectMap["location"] = bc.Location + } + if bc.Tags != nil { + objectMap["tags"] = bc.Tags + } + if bc.Sku != nil { + objectMap["sku"] = bc.Sku + } + if bc.Kind != "" { + objectMap["kind"] = bc.Kind + } + if bc.Etag != nil { + objectMap["etag"] = bc.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BotChannel struct. +func (bc *BotChannel) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicChannel(*v) + if err != nil { + return err + } + bc.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bc.Name = &name + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bc.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bc.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bc.Tags = tags + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + bc.Sku = &sku + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + bc.Kind = kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bc.Etag = &etag + } + } + } + + return nil +} + +// BotProperties the parameters to provide for the Bot. +type BotProperties struct { + // DisplayName - The Name of the bot + DisplayName *string `json:"displayName,omitempty"` + // Description - The description of the bot + Description *string `json:"description,omitempty"` + // IconURL - The Icon Url of the bot + IconURL *string `json:"iconUrl,omitempty"` + // Endpoint - The bot's endpoint + Endpoint *string `json:"endpoint,omitempty"` + // EndpointVersion - READ-ONLY; The bot's endpoint version + EndpointVersion *string `json:"endpointVersion,omitempty"` + // MsaAppID - Microsoft App Id for the bot + MsaAppID *string `json:"msaAppId,omitempty"` + // ConfiguredChannels - READ-ONLY; Collection of channels for which the bot is configured + ConfiguredChannels *[]string `json:"configuredChannels,omitempty"` + // EnabledChannels - READ-ONLY; Collection of channels for which the bot is enabled + EnabledChannels *[]string `json:"enabledChannels,omitempty"` + // DeveloperAppInsightKey - The Application Insights key + DeveloperAppInsightKey *string `json:"developerAppInsightKey,omitempty"` + // DeveloperAppInsightsAPIKey - The Application Insights Api Key + DeveloperAppInsightsAPIKey *string `json:"developerAppInsightsApiKey,omitempty"` + // DeveloperAppInsightsApplicationID - The Application Insights App Id + DeveloperAppInsightsApplicationID *string `json:"developerAppInsightsApplicationId,omitempty"` + // LuisAppIds - Collection of LUIS App Ids + LuisAppIds *[]string `json:"luisAppIds,omitempty"` + // LuisKey - The LUIS Key + LuisKey *string `json:"luisKey,omitempty"` + // IsCmekEnabled - Whether Cmek is enabled + IsCmekEnabled *bool `json:"isCmekEnabled,omitempty"` + // CmekKeyVaultURL - The CMK Url + CmekKeyVaultURL *string `json:"cmekKeyVaultUrl,omitempty"` + // IsIsolated - Whether the bot is in an isolated network + IsIsolated *bool `json:"isIsolated,omitempty"` + // SchemaTransformationVersion - The channel schema transformation version for the bot + SchemaTransformationVersion *string `json:"schemaTransformationVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for BotProperties. +func (bp BotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.DisplayName != nil { + objectMap["displayName"] = bp.DisplayName + } + if bp.Description != nil { + objectMap["description"] = bp.Description + } + if bp.IconURL != nil { + objectMap["iconUrl"] = bp.IconURL + } + if bp.Endpoint != nil { + objectMap["endpoint"] = bp.Endpoint + } + if bp.MsaAppID != nil { + objectMap["msaAppId"] = bp.MsaAppID + } + if bp.DeveloperAppInsightKey != nil { + objectMap["developerAppInsightKey"] = bp.DeveloperAppInsightKey + } + if bp.DeveloperAppInsightsAPIKey != nil { + objectMap["developerAppInsightsApiKey"] = bp.DeveloperAppInsightsAPIKey + } + if bp.DeveloperAppInsightsApplicationID != nil { + objectMap["developerAppInsightsApplicationId"] = bp.DeveloperAppInsightsApplicationID + } + if bp.LuisAppIds != nil { + objectMap["luisAppIds"] = bp.LuisAppIds + } + if bp.LuisKey != nil { + objectMap["luisKey"] = bp.LuisKey + } + if bp.IsCmekEnabled != nil { + objectMap["isCmekEnabled"] = bp.IsCmekEnabled + } + if bp.CmekKeyVaultURL != nil { + objectMap["cmekKeyVaultUrl"] = bp.CmekKeyVaultURL + } + if bp.IsIsolated != nil { + objectMap["isIsolated"] = bp.IsIsolated + } + if bp.SchemaTransformationVersion != nil { + objectMap["schemaTransformationVersion"] = bp.SchemaTransformationVersion + } + return json.Marshal(objectMap) +} + +// BotResponseList the list of bot service operation response. +type BotResponseList struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of bot service resources. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of bot service results and their properties. + Value *[]Bot `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for BotResponseList. +func (brl BotResponseList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if brl.NextLink != nil { + objectMap["nextLink"] = brl.NextLink + } + return json.Marshal(objectMap) +} + +// BotResponseListIterator provides access to a complete listing of Bot values. +type BotResponseListIterator struct { + i int + page BotResponseListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BotResponseListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotResponseListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BotResponseListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BotResponseListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BotResponseListIterator) Response() BotResponseList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BotResponseListIterator) Value() Bot { + if !iter.page.NotDone() { + return Bot{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BotResponseListIterator type. +func NewBotResponseListIterator(page BotResponseListPage) BotResponseListIterator { + return BotResponseListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brl BotResponseList) IsEmpty() bool { + return brl.Value == nil || len(*brl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brl BotResponseList) hasNextLink() bool { + return brl.NextLink != nil && len(*brl.NextLink) != 0 +} + +// botResponseListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brl BotResponseList) botResponseListPreparer(ctx context.Context) (*http.Request, error) { + if !brl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brl.NextLink))) +} + +// BotResponseListPage contains a page of Bot values. +type BotResponseListPage struct { + fn func(context.Context, BotResponseList) (BotResponseList, error) + brl BotResponseList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BotResponseListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BotResponseListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.brl) + if err != nil { + return err + } + page.brl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BotResponseListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BotResponseListPage) NotDone() bool { + return !page.brl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BotResponseListPage) Response() BotResponseList { + return page.brl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BotResponseListPage) Values() []Bot { + if page.brl.IsEmpty() { + return nil + } + return *page.brl.Value +} + +// Creates a new instance of the BotResponseListPage type. +func NewBotResponseListPage(cur BotResponseList, getNextPage func(context.Context, BotResponseList) (BotResponseList, error)) BotResponseListPage { + return BotResponseListPage{ + fn: getNextPage, + brl: cur, + } +} + +// BasicChannel channel definition +type BasicChannel interface { + AsAlexaChannel() (*AlexaChannel, bool) + AsFacebookChannel() (*FacebookChannel, bool) + AsEmailChannel() (*EmailChannel, bool) + AsMsTeamsChannel() (*MsTeamsChannel, bool) + AsSkypeChannel() (*SkypeChannel, bool) + AsKikChannel() (*KikChannel, bool) + AsWebChatChannel() (*WebChatChannel, bool) + AsDirectLineChannel() (*DirectLineChannel, bool) + AsTelegramChannel() (*TelegramChannel, bool) + AsSmsChannel() (*SmsChannel, bool) + AsSlackChannel() (*SlackChannel, bool) + AsLineChannel() (*LineChannel, bool) + AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) + AsChannel() (*Channel, bool) +} + +// Channel channel definition +type Channel struct { + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +func unmarshalBasicChannel(body []byte) (BasicChannel, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["channelName"] { + case string(ChannelNameAlexaChannel1): + var ac AlexaChannel + err := json.Unmarshal(body, &ac) + return ac, err + case string(ChannelNameFacebookChannel1): + var fc FacebookChannel + err := json.Unmarshal(body, &fc) + return fc, err + case string(ChannelNameEmailChannel1): + var ec EmailChannel + err := json.Unmarshal(body, &ec) + return ec, err + case string(ChannelNameMsTeamsChannel1): + var mtc MsTeamsChannel + err := json.Unmarshal(body, &mtc) + return mtc, err + case string(ChannelNameSkypeChannel1): + var sc SkypeChannel + err := json.Unmarshal(body, &sc) + return sc, err + case string(ChannelNameKikChannel1): + var kc KikChannel + err := json.Unmarshal(body, &kc) + return kc, err + case string(ChannelNameWebChatChannel1): + var wcc WebChatChannel + err := json.Unmarshal(body, &wcc) + return wcc, err + case string(ChannelNameDirectLineChannel1): + var dlc DirectLineChannel + err := json.Unmarshal(body, &dlc) + return dlc, err + case string(ChannelNameTelegramChannel1): + var tc TelegramChannel + err := json.Unmarshal(body, &tc) + return tc, err + case string(ChannelNameSmsChannel1): + var sc SmsChannel + err := json.Unmarshal(body, &sc) + return sc, err + case string(ChannelNameSlackChannel1): + var sc SlackChannel + err := json.Unmarshal(body, &sc) + return sc, err + case string(ChannelNameLineChannel1): + var lc LineChannel + err := json.Unmarshal(body, &lc) + return lc, err + case string(ChannelNameDirectLineSpeechChannel1): + var dlsc DirectLineSpeechChannel + err := json.Unmarshal(body, &dlsc) + return dlsc, err + default: + var c Channel + err := json.Unmarshal(body, &c) + return c, err + } +} +func unmarshalBasicChannelArray(body []byte) ([]BasicChannel, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cArray := make([]BasicChannel, len(rawMessages)) + + for index, rawMessage := range rawMessages { + c, err := unmarshalBasicChannel(*rawMessage) + if err != nil { + return nil, err + } + cArray[index] = c + } + return cArray, nil +} + +// MarshalJSON is the custom marshaler for Channel. +func (c Channel) MarshalJSON() ([]byte, error) { + c.ChannelName = ChannelNameChannel + objectMap := make(map[string]interface{}) + if c.ChannelName != "" { + objectMap["channelName"] = c.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for Channel. +func (c Channel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for Channel. +func (c Channel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for Channel. +func (c Channel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for Channel. +func (c Channel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for Channel. +func (c Channel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for Channel. +func (c Channel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for Channel. +func (c Channel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for Channel. +func (c Channel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for Channel. +func (c Channel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for Channel. +func (c Channel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for Channel. +func (c Channel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for Channel. +func (c Channel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for Channel. +func (c Channel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for Channel. +func (c Channel) AsChannel() (*Channel, bool) { + return &c, true +} + +// AsBasicChannel is the BasicChannel implementation for Channel. +func (c Channel) AsBasicChannel() (BasicChannel, bool) { + return &c, true +} + +// ChannelResponseList the list of bot service channel operation response. +type ChannelResponseList struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of bot service channel resources. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of bot service channel results and their properties. + Value *[]BotChannel `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ChannelResponseList. +func (crl ChannelResponseList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if crl.NextLink != nil { + objectMap["nextLink"] = crl.NextLink + } + return json.Marshal(objectMap) +} + +// ChannelResponseListIterator provides access to a complete listing of BotChannel values. +type ChannelResponseListIterator struct { + i int + page ChannelResponseListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ChannelResponseListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelResponseListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ChannelResponseListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ChannelResponseListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ChannelResponseListIterator) Response() ChannelResponseList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ChannelResponseListIterator) Value() BotChannel { + if !iter.page.NotDone() { + return BotChannel{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ChannelResponseListIterator type. +func NewChannelResponseListIterator(page ChannelResponseListPage) ChannelResponseListIterator { + return ChannelResponseListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (crl ChannelResponseList) IsEmpty() bool { + return crl.Value == nil || len(*crl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (crl ChannelResponseList) hasNextLink() bool { + return crl.NextLink != nil && len(*crl.NextLink) != 0 +} + +// channelResponseListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (crl ChannelResponseList) channelResponseListPreparer(ctx context.Context) (*http.Request, error) { + if !crl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(crl.NextLink))) +} + +// ChannelResponseListPage contains a page of BotChannel values. +type ChannelResponseListPage struct { + fn func(context.Context, ChannelResponseList) (ChannelResponseList, error) + crl ChannelResponseList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ChannelResponseListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ChannelResponseListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.crl) + if err != nil { + return err + } + page.crl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ChannelResponseListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ChannelResponseListPage) NotDone() bool { + return !page.crl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ChannelResponseListPage) Response() ChannelResponseList { + return page.crl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ChannelResponseListPage) Values() []BotChannel { + if page.crl.IsEmpty() { + return nil + } + return *page.crl.Value +} + +// Creates a new instance of the ChannelResponseListPage type. +func NewChannelResponseListPage(cur ChannelResponseList, getNextPage func(context.Context, ChannelResponseList) (ChannelResponseList, error)) ChannelResponseListPage { + return ChannelResponseListPage{ + fn: getNextPage, + crl: cur, + } +} + +// CheckNameAvailabilityRequestBody the request body for a request to Bot Service Management to check +// availability of a bot name. +type CheckNameAvailabilityRequestBody struct { + // Name - the name of the bot for which availability needs to be checked. + Name *string `json:"name,omitempty"` + // Type - the type of the bot for which availability needs to be checked + Type *string `json:"type,omitempty"` +} + +// CheckNameAvailabilityResponseBody the response body returned for a request to Bot Service Management to +// check availability of a bot name. +type CheckNameAvailabilityResponseBody struct { + autorest.Response `json:"-"` + // Valid - indicates if the bot name is valid. + Valid *bool `json:"valid,omitempty"` + // Message - additional message from the bot management api showing why a bot name is not available + Message *string `json:"message,omitempty"` +} + +// ConnectionItemName the display name of a connection Item Setting registered with the Bot +type ConnectionItemName struct { + // Name - READ-ONLY; Connection Item name that has been added in the API + Name *string `json:"name,omitempty"` +} + +// ConnectionSetting bot channel resource definition +type ConnectionSetting struct { + autorest.Response `json:"-"` + // Properties - The set of properties specific to bot channel resource + Properties *ConnectionSettingProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - Gets or sets the SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' + Kind Kind `json:"kind,omitempty"` + // Etag - Entity Tag + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionSetting. +func (cs ConnectionSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.Properties != nil { + objectMap["properties"] = cs.Properties + } + if cs.Location != nil { + objectMap["location"] = cs.Location + } + if cs.Tags != nil { + objectMap["tags"] = cs.Tags + } + if cs.Sku != nil { + objectMap["sku"] = cs.Sku + } + if cs.Kind != "" { + objectMap["kind"] = cs.Kind + } + if cs.Etag != nil { + objectMap["etag"] = cs.Etag + } + return json.Marshal(objectMap) +} + +// ConnectionSettingParameter extra Parameter in a Connection Setting Properties to indicate service +// provider specific properties +type ConnectionSettingParameter struct { + // Key - Key for the Connection Setting Parameter. + Key *string `json:"key,omitempty"` + // Value - Value associated with the Connection Setting Parameter. + Value *string `json:"value,omitempty"` +} + +// ConnectionSettingProperties properties for a Connection Setting Item +type ConnectionSettingProperties struct { + // ClientID - Client Id associated with the Connection Setting. + ClientID *string `json:"clientId,omitempty"` + // SettingID - READ-ONLY; Setting Id set by the service for the Connection Setting. + SettingID *string `json:"settingId,omitempty"` + // ClientSecret - Client Secret associated with the Connection Setting + ClientSecret *string `json:"clientSecret,omitempty"` + // Scopes - Scopes associated with the Connection Setting + Scopes *string `json:"scopes,omitempty"` + // ServiceProviderID - Service Provider Id associated with the Connection Setting + ServiceProviderID *string `json:"serviceProviderId,omitempty"` + // ServiceProviderDisplayName - Service Provider Display Name associated with the Connection Setting + ServiceProviderDisplayName *string `json:"serviceProviderDisplayName,omitempty"` + // Parameters - Service Provider Parameters associated with the Connection Setting + Parameters *[]ConnectionSettingParameter `json:"parameters,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionSettingProperties. +func (csp ConnectionSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csp.ClientID != nil { + objectMap["clientId"] = csp.ClientID + } + if csp.ClientSecret != nil { + objectMap["clientSecret"] = csp.ClientSecret + } + if csp.Scopes != nil { + objectMap["scopes"] = csp.Scopes + } + if csp.ServiceProviderID != nil { + objectMap["serviceProviderId"] = csp.ServiceProviderID + } + if csp.ServiceProviderDisplayName != nil { + objectMap["serviceProviderDisplayName"] = csp.ServiceProviderDisplayName + } + if csp.Parameters != nil { + objectMap["parameters"] = csp.Parameters + } + return json.Marshal(objectMap) +} + +// ConnectionSettingResponseList the list of bot service connection settings response. +type ConnectionSettingResponseList struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of bot service connection setting resources. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of bot service connection settings and their properties. + Value *[]ConnectionSetting `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionSettingResponseList. +func (csrl ConnectionSettingResponseList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csrl.NextLink != nil { + objectMap["nextLink"] = csrl.NextLink + } + return json.Marshal(objectMap) +} + +// ConnectionSettingResponseListIterator provides access to a complete listing of ConnectionSetting values. +type ConnectionSettingResponseListIterator struct { + i int + page ConnectionSettingResponseListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ConnectionSettingResponseListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionSettingResponseListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ConnectionSettingResponseListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ConnectionSettingResponseListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ConnectionSettingResponseListIterator) Response() ConnectionSettingResponseList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ConnectionSettingResponseListIterator) Value() ConnectionSetting { + if !iter.page.NotDone() { + return ConnectionSetting{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ConnectionSettingResponseListIterator type. +func NewConnectionSettingResponseListIterator(page ConnectionSettingResponseListPage) ConnectionSettingResponseListIterator { + return ConnectionSettingResponseListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (csrl ConnectionSettingResponseList) IsEmpty() bool { + return csrl.Value == nil || len(*csrl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (csrl ConnectionSettingResponseList) hasNextLink() bool { + return csrl.NextLink != nil && len(*csrl.NextLink) != 0 +} + +// connectionSettingResponseListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (csrl ConnectionSettingResponseList) connectionSettingResponseListPreparer(ctx context.Context) (*http.Request, error) { + if !csrl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(csrl.NextLink))) +} + +// ConnectionSettingResponseListPage contains a page of ConnectionSetting values. +type ConnectionSettingResponseListPage struct { + fn func(context.Context, ConnectionSettingResponseList) (ConnectionSettingResponseList, error) + csrl ConnectionSettingResponseList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ConnectionSettingResponseListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionSettingResponseListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.csrl) + if err != nil { + return err + } + page.csrl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ConnectionSettingResponseListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ConnectionSettingResponseListPage) NotDone() bool { + return !page.csrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ConnectionSettingResponseListPage) Response() ConnectionSettingResponseList { + return page.csrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ConnectionSettingResponseListPage) Values() []ConnectionSetting { + if page.csrl.IsEmpty() { + return nil + } + return *page.csrl.Value +} + +// Creates a new instance of the ConnectionSettingResponseListPage type. +func NewConnectionSettingResponseListPage(cur ConnectionSettingResponseList, getNextPage func(context.Context, ConnectionSettingResponseList) (ConnectionSettingResponseList, error)) ConnectionSettingResponseListPage { + return ConnectionSettingResponseListPage{ + fn: getNextPage, + csrl: cur, + } +} + +// DirectLineChannel direct Line channel definition +type DirectLineChannel struct { + // Properties - The set of properties specific to Direct Line channel resource + Properties *DirectLineChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for DirectLineChannel. +func (dlc DirectLineChannel) MarshalJSON() ([]byte, error) { + dlc.ChannelName = ChannelNameDirectLineChannel1 + objectMap := make(map[string]interface{}) + if dlc.Properties != nil { + objectMap["properties"] = dlc.Properties + } + if dlc.ChannelName != "" { + objectMap["channelName"] = dlc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return &dlc, true +} + +// AsTelegramChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for DirectLineChannel. +func (dlc DirectLineChannel) AsBasicChannel() (BasicChannel, bool) { + return &dlc, true +} + +// DirectLineChannelProperties the parameters to provide for the Direct Line channel. +type DirectLineChannelProperties struct { + // Sites - The list of Direct Line sites + Sites *[]DirectLineSite `json:"sites,omitempty"` +} + +// DirectLineSite a site for the Direct Line channel +type DirectLineSite struct { + // SiteID - READ-ONLY; Site Id + SiteID *string `json:"siteId,omitempty"` + // SiteName - Site name + SiteName *string `json:"siteName,omitempty"` + // Key - READ-ONLY; Primary key. Value only returned through POST to the action Channel List API, otherwise empty. + Key *string `json:"key,omitempty"` + // Key2 - READ-ONLY; Secondary key. Value only returned through POST to the action Channel List API, otherwise empty. + Key2 *string `json:"key2,omitempty"` + // IsEnabled - Whether this site is enabled for DirectLine channel. + IsEnabled *bool `json:"isEnabled,omitempty"` + // IsV1Enabled - Whether this site is enabled for Bot Framework V1 protocol. + IsV1Enabled *bool `json:"isV1Enabled,omitempty"` + // IsV3Enabled - Whether this site is enabled for Bot Framework V1 protocol. + IsV3Enabled *bool `json:"isV3Enabled,omitempty"` + // IsSecureSiteEnabled - Whether this site is enabled for authentication with Bot Framework. + IsSecureSiteEnabled *bool `json:"isSecureSiteEnabled,omitempty"` + // TrustedOrigins - List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled is True. + TrustedOrigins *[]string `json:"trustedOrigins,omitempty"` +} + +// MarshalJSON is the custom marshaler for DirectLineSite. +func (dls DirectLineSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dls.SiteName != nil { + objectMap["siteName"] = dls.SiteName + } + if dls.IsEnabled != nil { + objectMap["isEnabled"] = dls.IsEnabled + } + if dls.IsV1Enabled != nil { + objectMap["isV1Enabled"] = dls.IsV1Enabled + } + if dls.IsV3Enabled != nil { + objectMap["isV3Enabled"] = dls.IsV3Enabled + } + if dls.IsSecureSiteEnabled != nil { + objectMap["isSecureSiteEnabled"] = dls.IsSecureSiteEnabled + } + if dls.TrustedOrigins != nil { + objectMap["trustedOrigins"] = dls.TrustedOrigins + } + return json.Marshal(objectMap) +} + +// DirectLineSpeechChannel directLine Speech channel definition +type DirectLineSpeechChannel struct { + // Properties - The set of properties specific to DirectLine Speech channel resource + Properties *DirectLineSpeechChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) MarshalJSON() ([]byte, error) { + dlsc.ChannelName = ChannelNameDirectLineSpeechChannel1 + objectMap := make(map[string]interface{}) + if dlsc.Properties != nil { + objectMap["properties"] = dlsc.Properties + } + if dlsc.ChannelName != "" { + objectMap["channelName"] = dlsc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return &dlsc, true +} + +// AsChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for DirectLineSpeechChannel. +func (dlsc DirectLineSpeechChannel) AsBasicChannel() (BasicChannel, bool) { + return &dlsc, true +} + +// DirectLineSpeechChannelProperties the parameters to provide for the DirectLine Speech channel. +type DirectLineSpeechChannelProperties struct { + // CognitiveServiceRegion - The cognitive service region with this channel registration. + CognitiveServiceRegion *string `json:"cognitiveServiceRegion,omitempty"` + // CognitiveServiceSubscriptionKey - The cognitive service subscription key to use with this channel registration. + CognitiveServiceSubscriptionKey *string `json:"cognitiveServiceSubscriptionKey,omitempty"` + // IsEnabled - Whether this channel is enabled or not. + IsEnabled *bool `json:"isEnabled,omitempty"` + // CustomVoiceDeploymentID - Custom speech model id (optional). + CustomVoiceDeploymentID *string `json:"customVoiceDeploymentId,omitempty"` + // CustomSpeechModelID - Custom voice deployment id (optional). + CustomSpeechModelID *string `json:"customSpeechModelId,omitempty"` + // IsDefaultBotForCogSvcAccount - Make this a default bot for chosen cognitive service account. + IsDefaultBotForCogSvcAccount *bool `json:"isDefaultBotForCogSvcAccount,omitempty"` +} + +// EmailChannel email channel definition +type EmailChannel struct { + // Properties - The set of properties specific to email channel resource + Properties *EmailChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for EmailChannel. +func (ec EmailChannel) MarshalJSON() ([]byte, error) { + ec.ChannelName = ChannelNameEmailChannel1 + objectMap := make(map[string]interface{}) + if ec.Properties != nil { + objectMap["properties"] = ec.Properties + } + if ec.ChannelName != "" { + objectMap["channelName"] = ec.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsEmailChannel() (*EmailChannel, bool) { + return &ec, true +} + +// AsMsTeamsChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for EmailChannel. +func (ec EmailChannel) AsBasicChannel() (BasicChannel, bool) { + return &ec, true +} + +// EmailChannelProperties the parameters to provide for the Email channel. +type EmailChannelProperties struct { + // EmailAddress - The email address + EmailAddress *string `json:"emailAddress,omitempty"` + // Password - The password for the email address. Value only returned through POST to the action Channel List API, otherwise empty. + Password *string `json:"password,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// Error bot Service error object. +type Error struct { + // Error - The error body. + Error *ErrorBody `json:"error,omitempty"` +} + +// ErrorBody bot Service error body. +type ErrorBody struct { + // Code - error code + Code *string `json:"code,omitempty"` + // Message - error message + Message *string `json:"message,omitempty"` +} + +// FacebookChannel facebook channel definition +type FacebookChannel struct { + // Properties - The set of properties specific to bot facebook channel + Properties *FacebookChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for FacebookChannel. +func (fc FacebookChannel) MarshalJSON() ([]byte, error) { + fc.ChannelName = ChannelNameFacebookChannel1 + objectMap := make(map[string]interface{}) + if fc.Properties != nil { + objectMap["properties"] = fc.Properties + } + if fc.ChannelName != "" { + objectMap["channelName"] = fc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return &fc, true +} + +// AsEmailChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for FacebookChannel. +func (fc FacebookChannel) AsBasicChannel() (BasicChannel, bool) { + return &fc, true +} + +// FacebookChannelProperties the parameters to provide for the Facebook channel. +type FacebookChannelProperties struct { + // VerifyToken - READ-ONLY; Verify token. Value only returned through POST to the action Channel List API, otherwise empty. + VerifyToken *string `json:"verifyToken,omitempty"` + // Pages - The list of Facebook pages + Pages *[]FacebookPage `json:"pages,omitempty"` + // AppID - Facebook application id + AppID *string `json:"appId,omitempty"` + // AppSecret - Facebook application secret. Value only returned through POST to the action Channel List API, otherwise empty. + AppSecret *string `json:"appSecret,omitempty"` + // CallbackURL - READ-ONLY; Callback Url + CallbackURL *string `json:"callbackUrl,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for FacebookChannelProperties. +func (fcp FacebookChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.Pages != nil { + objectMap["pages"] = fcp.Pages + } + if fcp.AppID != nil { + objectMap["appId"] = fcp.AppID + } + if fcp.AppSecret != nil { + objectMap["appSecret"] = fcp.AppSecret + } + if fcp.IsEnabled != nil { + objectMap["isEnabled"] = fcp.IsEnabled + } + return json.Marshal(objectMap) +} + +// FacebookPage a Facebook page for Facebook channel registration +type FacebookPage struct { + // ID - Page id + ID *string `json:"id,omitempty"` + // AccessToken - Facebook application access token. Value only returned through POST to the action Channel List API, otherwise empty. + AccessToken *string `json:"accessToken,omitempty"` +} + +// HostSettingsResponse the response body returned for a request to Bot Service Management to check per +// subscription hostSettings +type HostSettingsResponse struct { + autorest.Response `json:"-"` + // OAuthURL - For in-conversation bot user authentication + OAuthURL *string `json:"OAuthUrl,omitempty"` + // ToBotFromChannelOpenIDMetadataURL - For verifying incoming tokens from the channels + ToBotFromChannelOpenIDMetadataURL *string `json:"ToBotFromChannelOpenIdMetadataUrl,omitempty"` + // ToBotFromChannelTokenIssuer - For verifying incoming tokens from the channels + ToBotFromChannelTokenIssuer *string `json:"ToBotFromChannelTokenIssuer,omitempty"` + // ToBotFromEmulatorOpenIDMetadataURL - For verifying incoming tokens from bot emulator + ToBotFromEmulatorOpenIDMetadataURL *string `json:"ToBotFromEmulatorOpenIdMetadataUrl,omitempty"` + // ToChannelFromBotLoginURL - For getting access token to channels from bot host + ToChannelFromBotLoginURL *string `json:"ToChannelFromBotLoginUrl,omitempty"` + // ToChannelFromBotOAuthScope - For getting access token to channels from bot host + ToChannelFromBotOAuthScope *string `json:"ToChannelFromBotOAuthScope,omitempty"` + // ValidateAuthority - Per cloud OAuth setting on whether authority is validated + ValidateAuthority *bool `json:"ValidateAuthority,omitempty"` + // BotOpenIDMetadata - Same as ToBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12 + BotOpenIDMetadata *string `json:"BotOpenIdMetadata,omitempty"` +} + +// KikChannel kik channel definition +type KikChannel struct { + // Properties - The set of properties specific to Kik channel resource + Properties *KikChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for KikChannel. +func (kc KikChannel) MarshalJSON() ([]byte, error) { + kc.ChannelName = ChannelNameKikChannel1 + objectMap := make(map[string]interface{}) + if kc.Properties != nil { + objectMap["properties"] = kc.Properties + } + if kc.ChannelName != "" { + objectMap["channelName"] = kc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsKikChannel() (*KikChannel, bool) { + return &kc, true +} + +// AsWebChatChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for KikChannel. +func (kc KikChannel) AsBasicChannel() (BasicChannel, bool) { + return &kc, true +} + +// KikChannelProperties the parameters to provide for the Kik channel. +type KikChannelProperties struct { + // UserName - The Kik user name + UserName *string `json:"userName,omitempty"` + // APIKey - Kik API key. Value only returned through POST to the action Channel List API, otherwise empty. + APIKey *string `json:"apiKey,omitempty"` + // IsValidated - Whether this channel is validated for the bot + IsValidated *bool `json:"isValidated,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// LineChannel line channel definition +type LineChannel struct { + // Properties - The set of properties specific to line channel resource + Properties *LineChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for LineChannel. +func (lc LineChannel) MarshalJSON() ([]byte, error) { + lc.ChannelName = ChannelNameLineChannel1 + objectMap := make(map[string]interface{}) + if lc.Properties != nil { + objectMap["properties"] = lc.Properties + } + if lc.ChannelName != "" { + objectMap["channelName"] = lc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsLineChannel() (*LineChannel, bool) { + return &lc, true +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for LineChannel. +func (lc LineChannel) AsBasicChannel() (BasicChannel, bool) { + return &lc, true +} + +// LineChannelProperties the parameters to provide for the Line channel. +type LineChannelProperties struct { + // LineRegistrations - The list of line channel registrations + LineRegistrations *[]LineRegistration `json:"lineRegistrations,omitempty"` + // CallbackURL - READ-ONLY; Callback Url to enter in line registration. + CallbackURL *string `json:"callbackUrl,omitempty"` + // IsValidated - READ-ONLY; Whether this channel is validated for the bot + IsValidated *bool `json:"isValidated,omitempty"` +} + +// MarshalJSON is the custom marshaler for LineChannelProperties. +func (lcp LineChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lcp.LineRegistrations != nil { + objectMap["lineRegistrations"] = lcp.LineRegistrations + } + return json.Marshal(objectMap) +} + +// LineRegistration the properties corresponding to a line channel registration +type LineRegistration struct { + // GeneratedID - READ-ONLY; Id generated for the line channel registration + GeneratedID *string `json:"generatedId,omitempty"` + // ChannelSecret - Secret for the line channel registration + ChannelSecret *string `json:"channelSecret,omitempty"` + // ChannelAccessToken - Access token for the line channel registration + ChannelAccessToken *string `json:"channelAccessToken,omitempty"` +} + +// MarshalJSON is the custom marshaler for LineRegistration. +func (lr LineRegistration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lr.ChannelSecret != nil { + objectMap["channelSecret"] = lr.ChannelSecret + } + if lr.ChannelAccessToken != nil { + objectMap["channelAccessToken"] = lr.ChannelAccessToken + } + return json.Marshal(objectMap) +} + +// MsTeamsChannel microsoft Teams channel definition +type MsTeamsChannel struct { + // Properties - The set of properties specific to Microsoft Teams channel resource + Properties *MsTeamsChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for MsTeamsChannel. +func (mtc MsTeamsChannel) MarshalJSON() ([]byte, error) { + mtc.ChannelName = ChannelNameMsTeamsChannel1 + objectMap := make(map[string]interface{}) + if mtc.Properties != nil { + objectMap["properties"] = mtc.Properties + } + if mtc.ChannelName != "" { + objectMap["channelName"] = mtc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return &mtc, true +} + +// AsSkypeChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for MsTeamsChannel. +func (mtc MsTeamsChannel) AsBasicChannel() (BasicChannel, bool) { + return &mtc, true +} + +// MsTeamsChannelProperties the parameters to provide for the Microsoft Teams channel. +type MsTeamsChannelProperties struct { + // EnableCalling - Enable calling for Microsoft Teams channel + EnableCalling *bool `json:"enableCalling,omitempty"` + // CallingWebHook - Webhook for Microsoft Teams channel calls + CallingWebHook *string `json:"callingWebHook,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// OperationDisplayInfo the operation supported by Bot Service Management. +type OperationDisplayInfo struct { + // Description - The description of the operation. + Description *string `json:"description,omitempty"` + // Operation - The action that users can perform, based on their permission level. + Operation *string `json:"operation,omitempty"` + // Provider - Service provider: Microsoft Bot Service. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` +} + +// OperationEntity the operations supported by Bot Service Management. +type OperationEntity struct { + // Name - Operation name: {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + // Display - The operation supported by Bot Service Management. + Display *OperationDisplayInfo `json:"display,omitempty"` + // Origin - The origin of the operation. + Origin *string `json:"origin,omitempty"` + // Properties - Additional properties. + Properties interface{} `json:"properties,omitempty"` +} + +// OperationEntityListResult the list of bot service operation response. +type OperationEntityListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of operations. + NextLink *string `json:"nextLink,omitempty"` + // Value - The list of operations. + Value *[]OperationEntity `json:"value,omitempty"` +} + +// OperationEntityListResultIterator provides access to a complete listing of OperationEntity values. +type OperationEntityListResultIterator struct { + i int + page OperationEntityListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationEntityListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationEntityListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationEntityListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationEntityListResultIterator) Response() OperationEntityListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationEntityListResultIterator) Value() OperationEntity { + if !iter.page.NotDone() { + return OperationEntity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationEntityListResultIterator type. +func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator { + return OperationEntityListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oelr OperationEntityListResult) IsEmpty() bool { + return oelr.Value == nil || len(*oelr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oelr OperationEntityListResult) hasNextLink() bool { + return oelr.NextLink != nil && len(*oelr.NextLink) != 0 +} + +// operationEntityListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oelr OperationEntityListResult) operationEntityListResultPreparer(ctx context.Context) (*http.Request, error) { + if !oelr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oelr.NextLink))) +} + +// OperationEntityListResultPage contains a page of OperationEntity values. +type OperationEntityListResultPage struct { + fn func(context.Context, OperationEntityListResult) (OperationEntityListResult, error) + oelr OperationEntityListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationEntityListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oelr) + if err != nil { + return err + } + page.oelr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationEntityListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationEntityListResultPage) NotDone() bool { + return !page.oelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationEntityListResultPage) Response() OperationEntityListResult { + return page.oelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationEntityListResultPage) Values() []OperationEntity { + if page.oelr.IsEmpty() { + return nil + } + return *page.oelr.Value +} + +// Creates a new instance of the OperationEntityListResultPage type. +func NewOperationEntityListResultPage(cur OperationEntityListResult, getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage { + return OperationEntityListResultPage{ + fn: getNextPage, + oelr: cur, + } +} + +// Resource azure resource +type Resource struct { + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - READ-ONLY; Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - Gets or sets the SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // Kind - Required. Gets or sets the Kind of the resource. Possible values include: 'KindSdk', 'KindDesigner', 'KindBot', 'KindFunction', 'KindAzurebot' + Kind Kind `json:"kind,omitempty"` + // Etag - Entity Tag + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + if r.Sku != nil { + objectMap["sku"] = r.Sku + } + if r.Kind != "" { + objectMap["kind"] = r.Kind + } + if r.Etag != nil { + objectMap["etag"] = r.Etag + } + return json.Marshal(objectMap) +} + +// ServiceProvider service Provider Definition +type ServiceProvider struct { + // Properties - The Properties of a Service Provider Object + Properties *ServiceProviderProperties `json:"properties,omitempty"` +} + +// ServiceProviderParameter extra Parameters specific to each Service Provider +type ServiceProviderParameter struct { + // Name - READ-ONLY; Name of the Service Provider + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the Service Provider + Type *string `json:"type,omitempty"` + // DisplayName - READ-ONLY; Display Name of the Service Provider + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; Description of the Service Provider + Description *string `json:"description,omitempty"` + // HelpURL - READ-ONLY; Help Url for the Service Provider + HelpURL *string `json:"helpUrl,omitempty"` + // Default - READ-ONLY; Default Name for the Service Provider + Default *string `json:"default,omitempty"` +} + +// ServiceProviderProperties the Object used to describe a Service Provider supported by Bot Service +type ServiceProviderProperties struct { + // ID - READ-ONLY; Id for Service Provider + ID *string `json:"id,omitempty"` + // DisplayName - READ-ONLY; Display Name of the Service Provider + DisplayName *string `json:"displayName,omitempty"` + // ServiceProviderName - READ-ONLY; Display Name of the Service Provider + ServiceProviderName *string `json:"serviceProviderName,omitempty"` + // DevPortalURL - READ-ONLY; Display Name of the Service Provider + DevPortalURL *string `json:"devPortalUrl,omitempty"` + // IconURL - READ-ONLY; Display Name of the Service Provider + IconURL *string `json:"iconUrl,omitempty"` + // Parameters - The list of parameters for the Service Provider + Parameters *[]ServiceProviderParameter `json:"parameters,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceProviderProperties. +func (spp ServiceProviderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spp.Parameters != nil { + objectMap["parameters"] = spp.Parameters + } + return json.Marshal(objectMap) +} + +// ServiceProviderResponseList the list of bot service providers response. +type ServiceProviderResponseList struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of bot service providers. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of bot service providers and their properties. + Value *[]ServiceProvider `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceProviderResponseList. +func (sprl ServiceProviderResponseList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sprl.NextLink != nil { + objectMap["nextLink"] = sprl.NextLink + } + return json.Marshal(objectMap) +} + +// SiteInfo site information for WebChat or DirectLine Channels to identify which site to regenerate keys +// for. +type SiteInfo struct { + // SiteName - The site name + SiteName *string `json:"siteName,omitempty"` + // Key - Determines which key is to be regenerated. Possible values include: 'Key1', 'Key2' + Key Key `json:"key,omitempty"` +} + +// Sku the SKU of the cognitive services account. +type Sku struct { + // Name - The sku name. Possible values include: 'F0', 'S1' + Name SkuName `json:"name,omitempty"` + // Tier - READ-ONLY; Gets the sku tier. This is based on the SKU name. Possible values include: 'Free', 'Standard' + Tier SkuTier `json:"tier,omitempty"` +} + +// MarshalJSON is the custom marshaler for Sku. +func (s Sku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.Name != "" { + objectMap["name"] = s.Name + } + return json.Marshal(objectMap) +} + +// SkypeChannel skype channel definition +type SkypeChannel struct { + // Properties - The set of properties specific to Skype channel resource + Properties *SkypeChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkypeChannel. +func (sc SkypeChannel) MarshalJSON() ([]byte, error) { + sc.ChannelName = ChannelNameSkypeChannel1 + objectMap := make(map[string]interface{}) + if sc.Properties != nil { + objectMap["properties"] = sc.Properties + } + if sc.ChannelName != "" { + objectMap["channelName"] = sc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return &sc, true +} + +// AsKikChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for SkypeChannel. +func (sc SkypeChannel) AsBasicChannel() (BasicChannel, bool) { + return &sc, true +} + +// SkypeChannelProperties the parameters to provide for the Microsoft Teams channel. +type SkypeChannelProperties struct { + // EnableMessaging - Enable messaging for Skype channel + EnableMessaging *bool `json:"enableMessaging,omitempty"` + // EnableMediaCards - Enable media cards for Skype channel + EnableMediaCards *bool `json:"enableMediaCards,omitempty"` + // EnableVideo - Enable video for Skype channel + EnableVideo *bool `json:"enableVideo,omitempty"` + // EnableCalling - Enable calling for Skype channel + EnableCalling *bool `json:"enableCalling,omitempty"` + // EnableScreenSharing - Enable screen sharing for Skype channel + EnableScreenSharing *bool `json:"enableScreenSharing,omitempty"` + // EnableGroups - Enable groups for Skype channel + EnableGroups *bool `json:"enableGroups,omitempty"` + // GroupsMode - Group mode for Skype channel + GroupsMode *string `json:"groupsMode,omitempty"` + // CallingWebHook - Calling web hook for Skype channel + CallingWebHook *string `json:"callingWebHook,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// SlackChannel slack channel definition +type SlackChannel struct { + // Properties - The set of properties specific to Slack channel resource + Properties *SlackChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SlackChannel. +func (sc SlackChannel) MarshalJSON() ([]byte, error) { + sc.ChannelName = ChannelNameSlackChannel1 + objectMap := make(map[string]interface{}) + if sc.Properties != nil { + objectMap["properties"] = sc.Properties + } + if sc.ChannelName != "" { + objectMap["channelName"] = sc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsSlackChannel() (*SlackChannel, bool) { + return &sc, true +} + +// AsLineChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for SlackChannel. +func (sc SlackChannel) AsBasicChannel() (BasicChannel, bool) { + return &sc, true +} + +// SlackChannelProperties the parameters to provide for the Slack channel. +type SlackChannelProperties struct { + // ClientID - The Slack client id + ClientID *string `json:"clientId,omitempty"` + // ClientSecret - The Slack client secret. Value only returned through POST to the action Channel List API, otherwise empty. + ClientSecret *string `json:"clientSecret,omitempty"` + // VerificationToken - The Slack verification token. Value only returned through POST to the action Channel List API, otherwise empty. + VerificationToken *string `json:"verificationToken,omitempty"` + // LandingPageURL - The Slack landing page Url + LandingPageURL *string `json:"landingPageUrl,omitempty"` + // RedirectAction - READ-ONLY; The Slack redirect action + RedirectAction *string `json:"redirectAction,omitempty"` + // LastSubmissionID - READ-ONLY; The Sms auth token + LastSubmissionID *string `json:"lastSubmissionId,omitempty"` + // RegisterBeforeOAuthFlow - READ-ONLY; Whether to register the settings before OAuth validation is performed. Recommended to True. + RegisterBeforeOAuthFlow *bool `json:"registerBeforeOAuthFlow,omitempty"` + // IsValidated - READ-ONLY; Whether this channel is validated for the bot + IsValidated *bool `json:"isValidated,omitempty"` + // SigningSecret - The Slack signing secret. + SigningSecret *string `json:"signingSecret,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for SlackChannelProperties. +func (scp SlackChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scp.ClientID != nil { + objectMap["clientId"] = scp.ClientID + } + if scp.ClientSecret != nil { + objectMap["clientSecret"] = scp.ClientSecret + } + if scp.VerificationToken != nil { + objectMap["verificationToken"] = scp.VerificationToken + } + if scp.LandingPageURL != nil { + objectMap["landingPageUrl"] = scp.LandingPageURL + } + if scp.SigningSecret != nil { + objectMap["signingSecret"] = scp.SigningSecret + } + if scp.IsEnabled != nil { + objectMap["isEnabled"] = scp.IsEnabled + } + return json.Marshal(objectMap) +} + +// SmsChannel sms channel definition +type SmsChannel struct { + // Properties - The set of properties specific to Sms channel resource + Properties *SmsChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for SmsChannel. +func (sc SmsChannel) MarshalJSON() ([]byte, error) { + sc.ChannelName = ChannelNameSmsChannel1 + objectMap := make(map[string]interface{}) + if sc.Properties != nil { + objectMap["properties"] = sc.Properties + } + if sc.ChannelName != "" { + objectMap["channelName"] = sc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsSmsChannel() (*SmsChannel, bool) { + return &sc, true +} + +// AsSlackChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for SmsChannel. +func (sc SmsChannel) AsBasicChannel() (BasicChannel, bool) { + return &sc, true +} + +// SmsChannelProperties the parameters to provide for the Sms channel. +type SmsChannelProperties struct { + // Phone - The Sms phone + Phone *string `json:"phone,omitempty"` + // AccountSID - The Sms account SID. Value only returned through POST to the action Channel List API, otherwise empty. + AccountSID *string `json:"accountSID,omitempty"` + // AuthToken - The Sms auth token. Value only returned through POST to the action Channel List API, otherwise empty. + AuthToken *string `json:"authToken,omitempty"` + // IsValidated - Whether this channel is validated for the bot + IsValidated *bool `json:"isValidated,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// TelegramChannel telegram channel definition +type TelegramChannel struct { + // Properties - The set of properties specific to Telegram channel resource + Properties *TelegramChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for TelegramChannel. +func (tc TelegramChannel) MarshalJSON() ([]byte, error) { + tc.ChannelName = ChannelNameTelegramChannel1 + objectMap := make(map[string]interface{}) + if tc.Properties != nil { + objectMap["properties"] = tc.Properties + } + if tc.ChannelName != "" { + objectMap["channelName"] = tc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return nil, false +} + +// AsDirectLineChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return &tc, true +} + +// AsSmsChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for TelegramChannel. +func (tc TelegramChannel) AsBasicChannel() (BasicChannel, bool) { + return &tc, true +} + +// TelegramChannelProperties the parameters to provide for the Telegram channel. +type TelegramChannelProperties struct { + // AccessToken - The Telegram access token. Value only returned through POST to the action Channel List API, otherwise empty. + AccessToken *string `json:"accessToken,omitempty"` + // IsValidated - Whether this channel is validated for the bot + IsValidated *bool `json:"isValidated,omitempty"` + // IsEnabled - Whether this channel is enabled for the bot + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// WebChatChannel web Chat channel definition +type WebChatChannel struct { + // Properties - The set of properties specific to Web Chat channel resource + Properties *WebChatChannelProperties `json:"properties,omitempty"` + // ChannelName - Possible values include: 'ChannelNameChannel', 'ChannelNameAlexaChannel1', 'ChannelNameFacebookChannel1', 'ChannelNameEmailChannel1', 'ChannelNameMsTeamsChannel1', 'ChannelNameSkypeChannel1', 'ChannelNameKikChannel1', 'ChannelNameWebChatChannel1', 'ChannelNameDirectLineChannel1', 'ChannelNameTelegramChannel1', 'ChannelNameSmsChannel1', 'ChannelNameSlackChannel1', 'ChannelNameLineChannel1', 'ChannelNameDirectLineSpeechChannel1' + ChannelName ChannelNameBasicChannel `json:"channelName,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebChatChannel. +func (wcc WebChatChannel) MarshalJSON() ([]byte, error) { + wcc.ChannelName = ChannelNameWebChatChannel1 + objectMap := make(map[string]interface{}) + if wcc.Properties != nil { + objectMap["properties"] = wcc.Properties + } + if wcc.ChannelName != "" { + objectMap["channelName"] = wcc.ChannelName + } + return json.Marshal(objectMap) +} + +// AsAlexaChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsAlexaChannel() (*AlexaChannel, bool) { + return nil, false +} + +// AsFacebookChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsFacebookChannel() (*FacebookChannel, bool) { + return nil, false +} + +// AsEmailChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsEmailChannel() (*EmailChannel, bool) { + return nil, false +} + +// AsMsTeamsChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsMsTeamsChannel() (*MsTeamsChannel, bool) { + return nil, false +} + +// AsSkypeChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsSkypeChannel() (*SkypeChannel, bool) { + return nil, false +} + +// AsKikChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsKikChannel() (*KikChannel, bool) { + return nil, false +} + +// AsWebChatChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsWebChatChannel() (*WebChatChannel, bool) { + return &wcc, true +} + +// AsDirectLineChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsDirectLineChannel() (*DirectLineChannel, bool) { + return nil, false +} + +// AsTelegramChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsTelegramChannel() (*TelegramChannel, bool) { + return nil, false +} + +// AsSmsChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsSmsChannel() (*SmsChannel, bool) { + return nil, false +} + +// AsSlackChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsSlackChannel() (*SlackChannel, bool) { + return nil, false +} + +// AsLineChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsLineChannel() (*LineChannel, bool) { + return nil, false +} + +// AsDirectLineSpeechChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsDirectLineSpeechChannel() (*DirectLineSpeechChannel, bool) { + return nil, false +} + +// AsChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsChannel() (*Channel, bool) { + return nil, false +} + +// AsBasicChannel is the BasicChannel implementation for WebChatChannel. +func (wcc WebChatChannel) AsBasicChannel() (BasicChannel, bool) { + return &wcc, true +} + +// WebChatChannelProperties the parameters to provide for the Web Chat channel. +type WebChatChannelProperties struct { + // WebChatEmbedCode - READ-ONLY; Web chat control embed code + WebChatEmbedCode *string `json:"webChatEmbedCode,omitempty"` + // Sites - The list of Web Chat sites + Sites *[]WebChatSite `json:"sites,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebChatChannelProperties. +func (wccp WebChatChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wccp.Sites != nil { + objectMap["sites"] = wccp.Sites + } + return json.Marshal(objectMap) +} + +// WebChatSite a site for the Webchat channel +type WebChatSite struct { + // SiteID - READ-ONLY; Site Id + SiteID *string `json:"siteId,omitempty"` + // SiteName - Site name + SiteName *string `json:"siteName,omitempty"` + // Key - READ-ONLY; Primary key. Value only returned through POST to the action Channel List API, otherwise empty. + Key *string `json:"key,omitempty"` + // Key2 - READ-ONLY; Secondary key. Value only returned through POST to the action Channel List API, otherwise empty. + Key2 *string `json:"key2,omitempty"` + // IsEnabled - Whether this site is enabled for DirectLine channel + IsEnabled *bool `json:"isEnabled,omitempty"` + // EnablePreview - Whether this site is enabled for preview versions of Webchat + EnablePreview *bool `json:"enablePreview,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebChatSite. +func (wcs WebChatSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wcs.SiteName != nil { + objectMap["siteName"] = wcs.SiteName + } + if wcs.IsEnabled != nil { + objectMap["isEnabled"] = wcs.IsEnabled + } + if wcs.EnablePreview != nil { + objectMap["enablePreview"] = wcs.EnablePreview + } + return json.Marshal(objectMap) +} diff --git a/services/botservice/mgmt/2021-03-01/botservice/operations.go b/services/botservice/mgmt/2021-03-01/botservice/operations.go new file mode 100644 index 000000000000..d8ff234c1172 --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/operations.go @@ -0,0 +1,140 @@ +package botservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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/tracing" + "net/http" +) + +// OperationsClient is the azure Bot Service is a platform for creating smart conversational agents. +type OperationsClient struct { + BaseClient +} + +// 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 using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all the available BotService operations. +func (client OperationsClient) List(ctx context.Context) (result OperationEntityListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.oelr.Response.Response != nil { + sc = result.oelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.oelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.oelr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.oelr.hasNextLink() && result.oelr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.BotService/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// 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 client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// 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, + 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(ctx context.Context, lastResults OperationEntityListResult) (result OperationEntityListResult, err error) { + req, err := lastResults.operationEntityListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "botservice.OperationsClient", "listNextResults", 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, "botservice.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "botservice.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationEntityListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/botservice/mgmt/2021-03-01/botservice/version.go b/services/botservice/mgmt/2021-03-01/botservice/version.go new file mode 100644 index 000000000000..cab5ef5cac87 --- /dev/null +++ b/services/botservice/mgmt/2021-03-01/botservice/version.go @@ -0,0 +1,19 @@ +package botservice + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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() + " botservice/2021-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}