Skip to content
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

Client.userExists method of azwebpubsub unexported #24042

Open
petrosxen12 opened this issue Feb 3, 2025 · 4 comments
Open

Client.userExists method of azwebpubsub unexported #24042

petrosxen12 opened this issue Feb 3, 2025 · 4 comments
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that WebPubSub

Comments

@petrosxen12
Copy link

Hello all,

From the documentation of the azwebpubsub package v0.1.0, the types UserExistsOptions and UserExistsResponse are available (reference) , however the method client.UserExists is not available in the documentation.

The method exists in client.go (reference) but appears to be unexported due to lower-case u. This in turn leads to the method not appearing in the package docs.

From client.go line 1188:
func (client *Client) userExists(ctx context.Context, hub string, userID string, options *UserExistsOptions) (UserExistsResponse, error) {

Could we please verify if this is intentional and the Client.userExists method should not be used?

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Feb 3, 2025
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Feb 3, 2025
@vicancy
Copy link
Member

vicancy commented Feb 12, 2025

Thanks for reporting the issue, User/Group/ConnectionExists and CheckPermission APIs are currently not supported by go SDK, it is currently intentionally marked as internal. It is not yet supported because the *Exists REST APIs leverage HTTP response status code 404 to indicate that the User/Group/Connection does not exist. Such logic is not yet supported in go SDK, as explained in this comment https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azwebpubsub/autorest.md?plain=1#L34.

Hi @jhendrixMSFT, is there any updates on supporting 404 response code as false method return? Any insights on support such APIs in Go?

@jhendrixMSFT
Copy link
Member

The code generator supports this pattern but it's off by default. You'll need to add head-as-boolean: true to the autorest.md file and remove the transform that unexports it before regenerating the SDK.

From our conversations before release, the plan was to omit these APIs until there was an ask for them (the *Exists APIs in general are racy by definition so we omit them by default).

cc @JeffreyRichter

@JeffreyRichter
Copy link
Member

Yes, Joel is correct. All *Exists functions encourage customers to write code that is subject to race conditions and so we never recommend the usage of them. In fact, the service probably should not offer these operations. Hence, to lead customers down the pit of success, we purposely hid them from the public interface.

@vicancy
Copy link
Member

vicancy commented Feb 17, 2025

Hi @petrosxen12, as Jeffrey and Joel mentioned, *Exists functions generally encourages code that can be prone to race conditions and we intentionally hide them for now. That said, we completely understand that different use cases might require different solutions.

Could you share a bit more about your specific scenario where the UserExists API would be helpful? We’d love to better understand your use case and see if there’s a way to address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that WebPubSub
Projects
None yet
Development

No branches or pull requests

4 participants