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

Add HttpLongRunningOperationResponse #46

Merged
2 commits merged into from
Aug 15, 2018
Merged

Add HttpLongRunningOperationResponse #46

2 commits merged into from
Aug 15, 2018

Conversation

ghost
Copy link

@ghost ghost commented Aug 1, 2018

Resolves Azure/azure-sdk-for-node#2871 (partially).

This PR adds the HttpLongRunningOperationResponse type to ms-rest-azure-js. This is the public facing polling object that encapsulates the complexity of the LROPollStrategy types and exposes a nicer facade that customers can work with. It enables customers to get the current status of their LRO, to do a single poll, to poll until the LRO is finished, or to get a memento of the LRO that can be saved to disk or sent across the network. This memento can later be used to restore the HttpLongRunningOperationStatus and continue polling.

@ghost ghost added this to the Sprint-122 milestone Aug 1, 2018
@ghost ghost self-assigned this Aug 1, 2018
@ghost ghost requested review from amarzavery and RikkiGibson August 1, 2018 00:31
@ghost ghost added the in progress label Aug 1, 2018
@RikkiGibson RikkiGibson self-assigned this Aug 2, 2018
}
}

export function createHttpLongRunningOperationResponseFromInitialResponse(azureServiceClient: AzureServiceClient, initialResponse: HttpOperationResponse, options?: RequestOptionsBase): HttpLongRunningOperationResponse {
Copy link
Member

Choose a reason for hiding this comment

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

What makes export necessary for these 2 functions?

Copy link
Author

Choose a reason for hiding this comment

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

These two functions serve as the constructor functions for HttpLongRunningOperationResponse objects. They're both used by the AzureServiceClient class.

} else {
throw new Error("Can't determine long running operation polling strategy from initial response.");
result = undefined;
Copy link
Member

Choose a reason for hiding this comment

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

Does it ever make sense to hit this line?

Copy link
Author

Choose a reason for hiding this comment

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

This line shouldn't ever be hit if all of our services properly follow the LRO specifications, but if they do something that is unexpected or if the initial response indicates that the operation has already completed, then this line will be hit.

@ghost ghost merged commit 27c50fa into master Aug 15, 2018
@ghost ghost deleted the daschult/lroresponse branch August 15, 2018 18:34
@ghost ghost removed the in progress label Aug 15, 2018
@RikkiGibson
Copy link
Member

Is there any need to bump the minor version before publishing?

@ghost
Copy link
Author

ghost commented Aug 15, 2018

Not yet. There weren't any breaking changes in this PR. Just additive changes.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support to pause, resume and get current status of polling in an LRO
1 participant