-
Notifications
You must be signed in to change notification settings - Fork 252
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
migrate SDKs to use HTTP pipeline #802
Comments
@cataggar - was looking into using service principal credentials with the Rather then making an intermediate change to support identity based auth in the blobs crate, I felt it might be more sustainable to move to the pipeline architecture... That said, this is a major refractor in the crate, and I was wondering if it makes sense to adopt the generated service crate while at it. Mainly b/c I do seem to remember seeing some issue in this repo concerning the generated blob crate that might be blocking, but not sure anymore ... 😄. |
Let's do this epic first to migrate to the HTTP Pipeline. The epic to be on top of the generated services #803 is going to take longer. I updated that issue to explain why. |
@cataggar I want to help out on somethings :) |
Still todo:
|
I'd be happy to give iothub a try and push it over the finish line after, since its already migrated to using operations ... |
@roeap please feel free to! |
An HTTP pipeline general guidelines:
https://azure.github.io/azure-sdk/general_azurecore.html
into_future
#677find_blobs_by_tags
to pipeline #826A description copied from #290:
Previous to the pipeline architecture, each operation was independently controlled meaning there was no central way to control the way operations were performed.
The pipeline architecture on the other hand allows users of the SDK to create pipelines through which outgoing requests and incoming responses are processed. The pipeline are composed of "policies" which can both change the outgoing request and the incoming response. Policies are usually either on a "per-request" basis (meaning they are called only once per operation) or "per-retry" (meaning they are applied every time an operation is attempted).
Examples of policies are the
TelemetryPolicy
which adds various telemetry headers to the request and the retry policy which checks whether an incoming response was successful and if it detects a transient failure, retries the request.Converting to the Architecture
For an example of converting one operation (Cosmos's
get_database
operation) over to the pipeline architecture, take a look at #286.The basic steps are:
operations
module where the operation will live. This submodule should be named after the operation (e.g., forget_database
it's calledget_database
).get_database
theGetDatabaseBuilder
) to new operation submodule and rename it fromBuilder
toOptions
(e.g.,GetDatabaseBuilder =>
GetDatabaseOptions`). This now represents the options that can be supplied when performing the operation. Note that many options that were part of the builder are no longer valid options because there will be individual policies that take their place. For instance, previously many operations took an option to set the user agent. This is now done by a policy.execute
method to adecorate_request
method that instead of performing the request, simply mutates a request parameter with any of the options supplied.get_database
theGetDatabaseResponse
type from theresponses
submodule to the operation submodule. Previously astd::convert::TryFrom
implementation was used to convert from anhttp::Response<Bytes>
object. This should now be a plain associated async function calledtry_from
that converts from the newResponse
type. See the example for how this should be done.get_database
this was theDatabaseClient::get_database
) to use the new options and response types with the pipeline. Again, see the example for how this should be done.The text was updated successfully, but these errors were encountered: