-
Notifications
You must be signed in to change notification settings - Fork 5.6k
BotService: Support for channel management in bots #2887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Automation for azure-libraries-for-javaNothing to generate for azure-libraries-for-java |
Automation for azure-sdk-for-nodeNothing to generate for azure-sdk-for-node |
|
@olydis I'm re-starting this PR FYI. I got delayed discussing the approach to secrets with Gaurav from ARM team. |
Automation for azure-sdk-for-pythonThe initial PR has been merged into your service PR: |
Automation for azure-sdk-for-goNothing to generate for azure-sdk-for-go |
|
Hello @marstr! This RP was under pull request but we were collecting feedback from Gaurav so we deactivated it while we worked on it. Here is the previous pull request: #2793. The status was WaitForARMFeedback, hope we can pick up from there. I'm happy to answer any questions or have a quick call if you want to chat about the service :) |
|
Thanks for the context, @carlosscastro! I'll begin reviewing this PR tomorrow morning. |
| } | ||
| } | ||
| }, | ||
| "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/list": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carlosscastro - can we call this action listSomething? listResgistrationWithKeys or listRegistrationWithSecrets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! listChannelWithKeys then.
|
Confirmed with @carlosscastro that secrets wont be returned through GET/PUT response. A separate POST API has been added to list the resource with secrets. As discussed in the email thread, there was one issue with this but we deemed it would be ok and the RP is fine with this modeling. Signing off from ARM side. Just one note regarding the name of the action. |
…r pull request, and also adding support for multiple pages in facebook channel
marstr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments to get started with.
| ], | ||
| "description": "Creates a Bot Service. Bot Service is a resource group wide resource type.", | ||
| "operationId": "BotServices_Create", | ||
| "operationId": "Bots_Create", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the Operation Group that is associated with an Operation is a breaking change from the code gen perspective. For instance with the Go generator, each operation group has a client, and operations are dangled off of it.
Because this spec is in the stable folder, we don't accept breaking changes inside of an API Version without escalation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah got it, let's move everything to a preview folder then. I'll notify all the SDK owners to make sure they aren't caught off-guard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, moving to a preview folder in the next batch of changes.
| "description": "The name of the Bot resource." | ||
| }, | ||
| { | ||
| "name": "channelName", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple more fields are required to make this conform to our x-ms-enum extension. You can read more about it here:
https://github.com/Azure/autorest/blob/master/docs/extensions/readme.md#x-ms-enum
| "minLength": 2, | ||
| "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", | ||
| "description": "The name of the Bot resource." | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above are usually defined as a global parameters with the "x-ms-parameter-location":"method" property set.
This isn't strictly necessary, but it should lead to easier maintenance in the future for you. :)
| "description": "The name of the Bot resource." | ||
| }, | ||
| { | ||
| "name": "channelName", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this is used multiple times, I'd again recommend refactoring it into a global parameter that's referenced in each operation for consistency's sake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely, this will be great.
| "description": "The name of the Bot resource." | ||
| }, | ||
| { | ||
| "name": "channelName", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unclear to me if this is the same as the other "channelName" parameters. Is this supposed to be the same enum as is declared a few times above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm centralizing this into a common parameter.
| "description": "The name of the Bot resource." | ||
| }, | ||
| { | ||
| "name": "channelName", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
| "description": "Indicates the name of a supported channel", | ||
| "enum": [ | ||
| "FacebookChannel", | ||
| "EmailChannel" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ah, so it is actually defined! Please extend this and reference it in all of the "channelName" declarations above.
| "modelAsString": true | ||
| } | ||
| }, | ||
| "ChannelName": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] This seems like a pretty confusing name to me. It may be that you can't change it for whatever reason, but to me it seems like this should be named "ChannelType". Shouldn't the "ChannelName" be the name of the specific channel? Like, the type of the channel may be "TelegramChannel" and the name could be something like "My Super Awesome Friend Group".
edit: grammar
|
Also @carlosscastro, could you fix the new errors reported here: https://travis-ci.org/Azure/azure-rest-api-specs/jobs/367735550#L799 ? Some of them were introduced in this PR. edit: grammar |
|
Another thing @carlosscastro, as you mention:
As edit: grammar |
|
@marstr Thanks for the thorough review, it is greatly appreciated! Will have an update incorporating your feedback within the next few hours! |
…and updating readme.md to reflect the preview directory
|
Hi There, I am the AutoRest Linter Azure bot. I am here to help. My task is to analyze the situation from the AutoRest linter perspective. Please review the below analysis result: 💡 Please review potentially introduced Error(s)/Warning(s): Analysis Report 💡 File: AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback Thanks for your co-operation. |
|
@marstr did a good pass on your suggestions and fixed a few more things. I did not change ChannelNAme to ChannelType, as in our system channel type has a different meaning (first party, 3rd party, extension) so it would be confusing for users. |
No worries, I figured as much. Just figured I'd drop my two cents. |
|
Quick question, I see this has ARM sign-off, but did it ever go through the API Review board? |
|
Reading @azuresdkciprbot's comment, it looks like a bunch of RPC Violations were introduced in the most recent commit. (Or more likely, we fixed something that unblocked its ability to see the violations.) Almost all of them have to do with using booleans instead of something more descriptive. Usually that's something to bothers the ARM team, but I see that you have @ravbhatnagar's approval. From an SDK point of view, it's not really a problem. If this has already been approved by the API Review Board, as I mention above, then I'm okay with it. If these definitions are not going to change, we should add suppressions to prevent noise in future reviews. |
|
Hi @marstr! We designed this change starting with a meeting with the OpenApi council, including ARM members and @fearthecowboy. They did recommend me this approach to channels and did a first review some time back. I'd definitely open for them to take a last peek if that is the process :) Regarding the booleans, yes, we discussed this some time back and we prefer to let them through. If in the future there might be more potential states, we'd do enums (we did many enums in this change where we deemed it necessary). But for all the booleans that we have, we know that they will stay binary. Edit: answer question on booleans |
| "Channel" | ||
| ], | ||
| "description": "Lists a Channel registration for a Bot Service including secrets", | ||
| "operationId": "Channel_List", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be updated to "operationId": "Channels_ListWithKeys".
Updating "Channel" to "Channels" is to be consistent with the operations above. Without the change, our code generators would generate both a ChannelClient and a ChannelsClient.
Our RPC bot identified the omitted "WithKeys". The logic being, if it was important enough to convey the "WithKeys" in the path, it must be important enough to convey in the generated SDKs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's another RPC Violation noted by the bot:
"The child tracked resource, 'channels' with immediate parent 'Bot', must have a list by immediate parent operation."
Truthfully, I'm not familiar with this error. I believe it's complaining that there isn't an operation registered under the path "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/list"
That could reverse the conclusion of the comment above, and instead of changing the operationId to "Channels_ListWithKeys" you may update it to just "Channels_List", but change the path its registered.
Another option is that your service may needs both a "List" and a "ListWithKeys".
If none of those options make sense, we may be able to just add a suppression. Just let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will rename to Channels_ListWithKeys for consistency, good catch!
Regarding the violation, that operation does not make sense in our context which is why we chose not to expose it. I think a suppression would be fine here.
I will put the change for the operationId in 2 minutes :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, I'll add the suppression also.
Sweet, this is is no problem then. We should add suppresions to the README file for all of the boolean usage warnings. :) |
|
Hi There, I am the AutoRest Linter Azure bot. I am here to help. My task is to analyze the situation from the AutoRest linter perspective. Please review the below analysis result: File: AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback Thanks for your co-operation. |
|
@marstr the latest changes are out. We are a bit in a time constrain while we get closer to //BUILD conference. Do we need more folks to review? If yes, can we include them today so we get this moving? Thanks for all your help :) |
|
No other reviewers are necessary. :) Are you ready for me to merge this? |
|
Awesome, thanks for your review @marstr! Actually - lets not merge for 2 hours, so I consult with my team members whether they have any changes being prepared (I think there are not, but want to confirm to simplify you work and avoid a new PR) How is the process to move this to stable? Let it sit for 1 month or so? |
|
@marstr Confirmed - we are good to merge :) Thanks again for all your help! |
We can move it to stable whenever your team feels that's appropriate. :) However, breaking changes aren't allowed in the When you folks are comfortable saying no more breaking changes are coming inside of a given API Version, we can submit a new PR that just moves which folder its in. When that happens, a few languages that our teams own should recognize that it's now safe to start publishing without any "-beta" or similar caveats. |
|
@marstr seems like the right thing to do, let's keep it in preview until it feels stable, probably 1 month after //BUILD. |
The goal of this pull request is mainly to introduce Channels, which are different means to expose a bot. Given that a bot resource has multiple channels, we have modeled the channels as a nested (and proxy only) resource of the bot.
We have multiple channels where bots can be exposed, and each has a different payload, but there is common information and machinery across channels as well.
This is why we modeled channels the following way
/botservice/{botid}/channel/{channelid}
Where channel id specifies the type of the channel, such as Facebook, Email or Skype. In the swagger , given that each channel has a specific payload, we create a base class channel and then inherited classes, making use of the "discriminator" feature of swagger.
This checklist is used to make sure that common issues in a pull request are addressed. This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.
PR information
api-versionin the path should match theapi-versionin the spec).Quality of Swagger