Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions specification/botservice/BotService.Management/Bot.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.BotService;
/**
* Bot resource definition
*/
model Bot is Azure.ResourceManager.TrackedResource<BotProperties> {
...ResourceNameParameter<
Resource = Bot,
KeyName = "resourceName",
SegmentName = "botServices",
NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"
>;

/**
* Gets or sets the SKU of the resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
sku?: Sku;

/**
* Required. Gets or sets the Kind of the resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
kind?: Kind;

/**
* Entity Tag.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
etag?: string;

/**
* Entity zones
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@visibility(Lifecycle.Read)
zones?: string[];
}

@armResourceOperations
interface Bots {
/**
* Returns a BotService specified by the parameters.
*/
get is ArmResourceRead<Bot, Error = Error>;

/**
* Creates a Bot Service. Bot Service is a resource group wide resource type.
*/
create is ArmResourceCreateOrReplaceSync<Bot, Error = Error>;

/**
* Updates a Bot Service
*/
@patch(#{ implicitOptionality: false })
update is ArmCustomPatchSync<
Bot,
PatchModel = Bot,
Response = ArmResponse<Bot> | ArmResourceCreatedSyncResponse<Bot>,
Error = Error
>;

/**
* Deletes a Bot Service from the resource group.
*/
delete is ArmResourceDeleteSync<Bot, Error = Error>;

/**
* Returns all the resources of a particular type belonging to a resource group
*/
listByResourceGroup is ArmResourceListByParent<
Bot,
Response = ArmResponse<BotResponseList>,
Error = Error
>;

/**
* Returns all the resources of a particular type belonging to a subscription.
*/
list is ArmListBySubscription<
Bot,
Response = ArmResponse<BotResponseList>,
Error = Error
>;

/**
* Creates an email channel sign in url for a Bot Service
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@action("createEmailSignInUrl")
createSignInUrl is ArmResourceActionSync<
Bot,
void,
ArmResponse<CreateEmailSignInUrlResponse>,
Error = Error
>;

/**
* Gets the private link resources that need to be created for a Bot.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@get
@action("privateLinkResources")
listByBotResource is ArmResourceActionSync<
Bot,
void,
ArmResponse<PrivateLinkResourceListResult>,
Error = Error
>;
}

@@maxLength(Bot.name, 64);
@@minLength(Bot.name, 2);
@@doc(Bot.name, "The name of the Bot resource.");
@@doc(Bot.properties, "The set of properties specific to bot resource");
@@doc(Bots.create::parameters.resource,
"The parameters to provide for the created bot."
);
@@doc(Bots.update::parameters.properties,
"The parameters to provide for the created bot."
);
186 changes: 186 additions & 0 deletions specification/botservice/BotService.Management/BotChannel.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Bot.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.BotService;
/**
* Bot channel resource definition
*/
@parentResource(Bot)
model BotChannel is Azure.ResourceManager.TrackedResource<Channel> {
...ResourceNameParameter<
Resource = BotChannel,
KeyName = "channelName",
SegmentName = "channels",
NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"
>;

/**
* Gets or sets the SKU of the resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
sku?: Sku;

/**
* Required. Gets or sets the Kind of the resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
kind?: Kind;

/**
* Entity Tag.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
etag?: string;

/**
* Entity zones
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@visibility(Lifecycle.Read)
zones?: string[];
}

@armResourceOperations
interface BotChannelOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,
...SubscriptionIdParameter,
...ResourceGroupParameter,
...Azure.ResourceManager.Legacy.Provider,

/**
* The name of the Bot resource.
*/
@path
@segment("botServices")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")
@maxLength(64)
@minLength(2)
resourceName: string,
},
{
/**
* The name of the Channel resource.
*/
@path
@segment("channels")
channelName: ChannelName,
},
ErrorType = Error
> {}

@armResourceOperations
interface BotChannelRegenerateKeysOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,
...SubscriptionIdParameter,
...ResourceGroupParameter,
...Azure.ResourceManager.Legacy.Provider,

/**
* The name of the Bot resource.
*/
@path
@segment("botServices")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")
@maxLength(64)
@minLength(2)
resourceName: string,
},
{
/**
* The name of the Channel resource for which keys are to be regenerated.
*/
@path
@segment("channels")
channelName: RegenerateKeysChannelName,
},
ErrorType = Error
> {}

@armResourceOperations
interface BotChannels {
/**
* Returns a BotService Channel registration specified by the parameters.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
get is ArmResourceRead<BotChannel, Error = Error>;

/**
* Creates a Channel registration for a Bot Service
*/
create is BotChannelOps.CreateOrUpdateSync<BotChannel>;

/**
* Updates a Channel registration for a Bot Service
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@patch(#{ implicitOptionality: false })
update is BotChannelOps.CustomPatchSync<
BotChannel,
PatchModel = BotChannel,
Response = ArmResponse<BotChannel> | ArmResourceCreatedSyncResponse<BotChannel>
>;

/**
* Deletes a Channel registration from a Bot Service
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
delete is ArmResourceDeleteSync<BotChannel, Error = Error>;

/**
* Returns all the Channel registrations of a particular BotService resource
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
listByResourceGroup is ArmResourceListByParent<
BotChannel,
Response = ArmResponse<ChannelResponseList>,
Error = Error
>;

/**
* Lists a Channel registration for a Bot Service including secrets
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@action("listChannelWithKeys")
listWithKeys is BotChannelOps.ActionSync<
BotChannel,
void,
ArmResponse<ListChannelWithKeysResponse>
>;

/**
* Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService resource
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@action("regeneratekeys")
regenerateKeys is BotChannelRegenerateKeysOps.ActionSync<
BotChannel,
SiteInfo,
ArmResponse<BotChannel>
>;
}

@@maxLength(BotChannel.name, 64);
@@minLength(BotChannel.name, 2);
@@doc(BotChannel.name, "The name of the Bot resource.");
@@doc(BotChannel.properties,
"The set of properties specific to bot channel resource"
);
@@doc(BotChannels.update::parameters.properties,
"The parameters to provide for the created bot."
);
@@doc(BotChannels.regenerateKeys::parameters.body,
"The parameters to provide for the created bot."
);
Loading
Loading