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

[FEATURE REQ] Add a TryGetSecret method #36942

Closed
Thiago-NovaesB opened this issue Jun 9, 2023 · 2 comments
Closed

[FEATURE REQ] Add a TryGetSecret method #36942

Thiago-NovaesB opened this issue Jun 9, 2023 · 2 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. KeyVault needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@Thiago-NovaesB
Copy link

Library name

Azure.Security.KeyVault.Secrets

Please describe the feature.

Currently, to recover secrets, there are only methods that return an error if it is not possible. (GetSecret, GetSecretAsync...).
However, this ends up generating an unwanted error. It would be nice to have TryGetSecret and TryGetSecretAsync. Which would return a bool if it managed to recover the secret (returning the value with out).

All the problem start here:

private Response SendRequest(Request request, CancellationToken cancellationToken)
{
    Response response = _pipeline.SendRequest(request, cancellationToken);

    switch (response.Status)
    {
        case 200:
        case 201:
        case 202:
        case 204:
            return response;
        default:
            throw Diagnostics.CreateRequestFailedException(response);
    }
}

It would be another one like:

private bool TrySendRequest(Request request, CancellationToken cancellationToken, out Response response)
{
    Response response = _pipeline.SendRequest(request, cancellationToken);

    switch (response.Status)
    {
        case 200:
        case 201:
        case 202:
        case 204:
            return true;
        default:
            return false;
    }
}

With TrySendRequest it will be possible to build all the others Try'methods.

@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 Jun 9, 2023
@jsquire jsquire added KeyVault Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Jun 9, 2023
@jsquire
Copy link
Member

jsquire commented Jun 9, 2023

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@heaths
Copy link
Member

heaths commented Jun 10, 2023

Duplicate of #25125

@heaths heaths marked this as a duplicate of #25125 Jun 10, 2023
@heaths heaths closed this as not planned Won't fix, can't repro, duplicate, stale Jun 10, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. KeyVault needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
Archived in project
Development

No branches or pull requests

3 participants