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

Implement proper WhatIf/Confirm support #24

Open
Smalls1652 opened this issue Feb 5, 2021 · 0 comments
Open

Implement proper WhatIf/Confirm support #24

Smalls1652 opened this issue Feb 5, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request high priority Issues that require urgent attention

Comments

@Smalls1652
Copy link
Owner

Smalls1652 commented Feb 5, 2021

Problem

Right now cmdlets that initiate potentially dangerous actions do not have any sort of -WhatIf or -Confirm support. This can be a problem for use-cases where a dry-run would be wanted.

Suggested Actions

Add SupportsShouldProcess and ConfirmImpact, if applicable, to the cmdlets. Then apply the ShouldProcess() method around the SendApiCall() method.

For example:

if (ShouldProcess("{target}", "{action}"))
{
string apiJson = SendApiCall(apiUri, apiPost, HttpMethod.Post);
T apiResult = new JsonConverter<T>(apiJson).Value;
WriteObject(apiResult);
}
@Smalls1652 Smalls1652 added the enhancement New feature or request label Feb 5, 2021
@Smalls1652 Smalls1652 self-assigned this Feb 5, 2021
@Smalls1652 Smalls1652 added the high priority Issues that require urgent attention label Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority Issues that require urgent attention
Projects
None yet
Development

No branches or pull requests

1 participant