-
Notifications
You must be signed in to change notification settings - Fork 315
begin LRO implementation for generated crates #1370
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
Conversation
This is an initial implementation for supporting `properties.provisioningState` model of long running operations. This models the Python SDK for how the state is extracted. Once each of the methods that identifying state are included, thish should be wrapped up into a trait that the clients can implement, rather than manually implementing the polling in the generated `into_future`.
Using the example, we get the following log:
|
Ffor using testing the
use azure_identity::AzureCliCredential;
use azure_mgmt_signalr::{
models::{ResourceSku, SignalRResource, TrackedResource},
Client,
};
use std::{env::args, sync::Arc};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init();
let resource_group = args().nth(1).expect("please specify resource group name");
let name = args().nth(2).expect("please specify resource name");
let location = args().nth(3).expect("please specify location");
let credential = Arc::new(AzureCliCredential::new());
let subscription_id = AzureCliCredential::get_subscription()?;
let client = Client::builder(credential).build();
let mut params = SignalRResource::new(TrackedResource::new(location));
params.sku = Some(ResourceSku::new("Standard_S1".to_string()));
let result = client
.signal_r_client()
.create_or_update(params, subscription_id, resource_group, name)
.await?;
println!("{:#?}", result);
Ok(())
} |
Cool! I suspect that this recent issue may also be due to lack of LRO support: |
S: Serialize, | ||
{ | ||
let body: serde_json::Value = | ||
serde_json::from_str(&serde_json::to_string(body).ok()?).ok()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The simplest way I could come up with to generically get the json path, regardless of the underlying response type was to parse it here, then reparse it by the caller.
My thought is this could eventually be retooled to be a macro or a trait, but this was significantly simpler to get functional.
This is an initial implementation for supporting long running operations. This models the Python SDK for how the state is extracted.
Eventually, this should be wrapped up into a trait that the clients can implement, rather than manually implementing the polling in the generated
into_future
.For evaluation, this PR includes generating the following crates:
azure-mgmt-keyvault
, as this crate usesproperties.provisioningState
to indicate LROazure-mgmt-signalr
, as this crate uses a combination ofLocation
andAzure-AsyncOperations
headers to indicate LRO