Skip to content

Conversation

@swagatmishra2007
Copy link
Contributor

@swagatmishra2007 swagatmishra2007 commented May 14, 2018

This changelist updates the swagger to be able to add/remote/update conneciton settings in botservice.
connection settings (called "connections" in the swagger) are a new feature in botservice related to authentication. Using this, a bot developer can select a service provider (like pinterest, aad, github etc) and then add a connection setting pertaining to this service. This lets his bot authenticate a user to a service provider and fetch a token on his behalf. Eg: you can add a github connection as a bot developer.Now a user of your bot can authenticate into github using your bot and access his git repositories.

@azuresdkciprbot
Copy link

AutoRest linter results for ARM Related Validation Errors/Warnings

These errors are reported by the ARM team's validation tools, reachout to ARM RP API Review directly for any questions or concerns.

File: specification/botservice/resource-manager/readme.md

⚠️0 new Warnings.(0 total)
0 new Errors.(0 total)

AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback

Thanks for your co-operation.

@azuresdkciprbot
Copy link

AutoRest linter results for SDK Related Validation Errors/Warnings

These errors are reported by the SDK team's validation tools, reachout to ADX Swagger Reviewers directly for any questions or concerns.

File: specification/botservice/resource-manager/readme.md

⚠️0 new Warnings.(0 total)
0 new Errors.(0 total)

AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback

Thanks for your co-operation.

@@ -0,0 +1,36 @@
{
"parameters": {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file name says ListTokensByBotService...shouldn't it be ListConnectionsByBotService?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

Copy link
Contributor

@ravbhatnagar ravbhatnagar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at the comments.

"type": "string",
"description": "Scopes associated with the Connection Setting"
},
"id": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

top level properties should not be repeated inside the properties envelope. Id is a top level property which implies the resource id for the connectionSetting resource. If this is the same id, you can remove it from here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

"type": "string",
"description": "Client Secret associated with the Connection Setting"
},
"scopes": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what can the scopes be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scopes are serviceprovider dependent and are comma-separated or whitespace separated.
for example, an example scope string for aad is "email.read email.write profile.read" the specific service provider logic knows how to handle this.

"type": "string",
"description": "Client Id associated with the Connection Setting."
},
"clientSecret": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not returned in the response of GET, PUT, PATCH. just confirming.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Also, i added a new listwithsecrets path, similar to how we have channel/listwithkeys method. On doing a post to this url, the caller can get a particular connectionname with the secrets present.
Otherwise, the clientsecret will not be returned in a normal get,put, patch

},
"ConnectionSettingProperties": {
"properties": {
"clientId": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do customers get this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is service provider specific and will be covered in the documentation.

"type": "string",
"description": "Id associated with the Connection Setting"
},
"name": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a top level property, which comes when you do a allOf on a "resource"

"type": "string",
"description": "Service Provider Id associated with the Connection Setting"
},
"serviceProviderDisplayName": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need both serviceProviderId and serviceProviderDisplayname to be provided? serviceProviderId should be sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The serviceproviderdisplayname is needed by the botservice azure portal blade to display the service providers available as a dropdown, when they add a connection. it makes better ui experience to have the display name than to have just the id.

}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/listServiceProviders": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this an action on the botService resource instead of an action on the provider itself? Are providers specific to an instance of the botService resource, likely not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made this an action on the botservice provider itself, since it's not specific to an instance of the resource

@ravbhatnagar ravbhatnagar added the WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required label May 15, 2018
@marstr
Copy link
Member

marstr commented May 15, 2018

Has this service gone through the API Review board? Given @ravbhatnagar's comments, it seems like it has not.

@AutorestCI
Copy link

AutorestCI commented May 16, 2018

Automation for azure-libraries-for-java

Nothing to generate for azure-libraries-for-java

@AutorestCI
Copy link

AutorestCI commented May 16, 2018

Automation for azure-sdk-for-node

Nothing to generate for azure-sdk-for-node

@AutorestCI
Copy link

AutorestCI commented May 16, 2018

Automation for azure-sdk-for-python

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-python#2337

@AutorestCI
Copy link

AutorestCI commented May 16, 2018

Automation for azure-sdk-for-go

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-go#1903

@ravbhatnagar ravbhatnagar added ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review and removed WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required labels May 18, 2018
@ravbhatnagar
Copy link
Contributor

Looks good.

@swagatmishra2007
Copy link
Contributor Author

@marstr we have the arm review signoff now. Can you please take a look and merge if it looks good?

"maxLength": 64,
"minLength": 2,
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$",
"description": "The name of the Bot Connection Setting resource."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the defintions like resourceName, resourceGroupName, and connectionName which seem to be repeated, I'd move them to the "definitions"/"parameters" section in order to make this Swagger more maintainable moving forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added these to be parameter definitions which are now referenced through out the swagger

"operationId": "BotConnection_ListWithSecrets",
"parameters": [
{
"name": "resourceGroupName",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty resourceGroupName being sent over the wire can result in really obfuscated errors being returned to the client. Please add some validation to the definition of resourceGroupName to prevent this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added validation similar to resource name

"ListServiceProviders"
],
"description": "Lists the available Service Providers for creating Connection Settings",
"operationId": "BotConnections_ListServiceProviders",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are two Operation Group names present here: "BotConnections" and "BotConnection" this will result in two separate client types being generated. Is this the intended behavior?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found another one "BotToken", should that be dangled off of a separate client?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed all "connections" and token references and updated them to be connection to keep things consistent

"Connections"
],
"description": "Returns all the Connection Settings registered to a particular BotService resource",
"operationId": "Connections_ListByBotService",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be `BotConnections_ListByBotService"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. changed it to botconnections

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it to botconnection_listbybotservice to keep it consistent.

@AutorestCI
Copy link

AutorestCI commented May 23, 2018

Automation for azure-sdk-for-ruby

Nothing to generate for azure-sdk-for-ruby

Copy link
Member

@marstr marstr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking a lot better!

}
},
"parameters": {
"resourceGroupNameParameter": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resourceGroupNameParameter and resourceNameParameter are missing the x-ms-parameter-location property, which can have some sorta gnarly code-gen repercussions.

I'd add "x-ms-parameter-location":"method", to both parameter definitions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@marstr
Copy link
Member

marstr commented May 23, 2018

Ready for me to merge, @swagatmishra2007?

@swagatmishra2007
Copy link
Contributor Author

@marstr thanks for the review! all done from my end. Please merge :)

@marstr marstr merged commit daa6778 into Azure:master May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants