Skip to content

Commit

Permalink
Implement Body for Box<T> where T: Body + ?Sized
Browse files Browse the repository at this point in the history
Some yaml integration tests specify inputs for bulk API
calls using different types to represent documents e.g.
objects intermixed with strings. Handle different
body representations with Vec<Box<dyn Body>>
  • Loading branch information
russcam authored and swallez committed Sep 1, 2022
1 parent 8113b45 commit 1b469ae
Show file tree
Hide file tree
Showing 40 changed files with 854 additions and 853 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl<'a> RequestBuilder<'a> {
let (fn_arg, field_arg, ret_ty) = if accepts_nd_body {
(
syn::parse_type("Vec<T>").unwrap(),
quote!(Some(NdBody(body))),
quote!(Some(NdBody::new(body))),
syn::FunctionRetTy::Ty(code_gen::ty(
format!("{}<'a, 'b, NdBody<T>> where T: Body", &builder_name).as_ref(),
)),
Expand Down
16 changes: 8 additions & 8 deletions elasticsearch/src/async_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<'b> AsyncSearchDeleteParts<'b> {
}
}
}
#[doc = "Builder for the [Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."]
#[doc = "Builder for the [Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."]
#[derive(Clone, Debug)]
pub struct AsyncSearchDelete<'a, 'b> {
transport: &'a Transport,
Expand Down Expand Up @@ -184,7 +184,7 @@ impl<'b> AsyncSearchGetParts<'b> {
}
}
}
#[doc = "Builder for the [Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."]
#[doc = "Builder for the [Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."]
#[derive(Clone, Debug)]
pub struct AsyncSearchGet<'a, 'b> {
transport: &'a Transport,
Expand Down Expand Up @@ -329,7 +329,7 @@ impl<'b> AsyncSearchStatusParts<'b> {
}
}
}
#[doc = "Builder for the [Async Search Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/async-search.html)\n\nRetrieves the status of a previously submitted async search request given its ID."]
#[doc = "Builder for the [Async Search Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nRetrieves the status of a previously submitted async search request given its ID."]
#[derive(Clone, Debug)]
pub struct AsyncSearchStatus<'a, 'b> {
transport: &'a Transport,
Expand Down Expand Up @@ -453,7 +453,7 @@ impl<'b> AsyncSearchSubmitParts<'b> {
}
}
}
#[doc = "Builder for the [Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/async-search.html)\n\nExecutes a search request asynchronously."]
#[doc = "Builder for the [Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nExecutes a search request asynchronously."]
#[derive(Clone, Debug)]
pub struct AsyncSearchSubmit<'a, 'b, B> {
transport: &'a Transport,
Expand Down Expand Up @@ -1005,19 +1005,19 @@ impl<'a> AsyncSearch<'a> {
pub fn transport(&self) -> &Transport {
self.transport
}
#[doc = "[Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."]
#[doc = "[Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."]
pub fn delete<'b>(&'a self, parts: AsyncSearchDeleteParts<'b>) -> AsyncSearchDelete<'a, 'b> {
AsyncSearchDelete::new(self.transport(), parts)
}
#[doc = "[Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."]
#[doc = "[Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."]
pub fn get<'b>(&'a self, parts: AsyncSearchGetParts<'b>) -> AsyncSearchGet<'a, 'b> {
AsyncSearchGet::new(self.transport(), parts)
}
#[doc = "[Async Search Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/async-search.html)\n\nRetrieves the status of a previously submitted async search request given its ID."]
#[doc = "[Async Search Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nRetrieves the status of a previously submitted async search request given its ID."]
pub fn status<'b>(&'a self, parts: AsyncSearchStatusParts<'b>) -> AsyncSearchStatus<'a, 'b> {
AsyncSearchStatus::new(self.transport(), parts)
}
#[doc = "[Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/async-search.html)\n\nExecutes a search request asynchronously."]
#[doc = "[Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nExecutes a search request asynchronously."]
pub fn submit<'b>(
&'a self,
parts: AsyncSearchSubmitParts<'b>,
Expand Down
16 changes: 8 additions & 8 deletions elasticsearch/src/autoscaling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<'b> AutoscalingDeleteAutoscalingPolicyParts<'b> {
}
}
}
#[doc = "Builder for the [Autoscaling Delete Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/autoscaling-delete-autoscaling-policy.html)\n\nDeletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[doc = "Builder for the [Autoscaling Delete Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-delete-autoscaling-policy.html)\n\nDeletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[derive(Clone, Debug)]
pub struct AutoscalingDeleteAutoscalingPolicy<'a, 'b> {
transport: &'a Transport,
Expand Down Expand Up @@ -181,7 +181,7 @@ impl AutoscalingGetAutoscalingCapacityParts {
}
}
}
#[doc = "Builder for the [Autoscaling Get Autoscaling Capacity API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/autoscaling-get-autoscaling-capacity.html)\n\nGets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[doc = "Builder for the [Autoscaling Get Autoscaling Capacity API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-get-autoscaling-capacity.html)\n\nGets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[derive(Clone, Debug)]
pub struct AutoscalingGetAutoscalingCapacity<'a, 'b> {
transport: &'a Transport,
Expand Down Expand Up @@ -299,7 +299,7 @@ impl<'b> AutoscalingGetAutoscalingPolicyParts<'b> {
}
}
}
#[doc = "Builder for the [Autoscaling Get Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/autoscaling-get-autoscaling-policy.html)\n\nRetrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[doc = "Builder for the [Autoscaling Get Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-get-autoscaling-policy.html)\n\nRetrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[derive(Clone, Debug)]
pub struct AutoscalingGetAutoscalingPolicy<'a, 'b> {
transport: &'a Transport,
Expand Down Expand Up @@ -417,7 +417,7 @@ impl<'b> AutoscalingPutAutoscalingPolicyParts<'b> {
}
}
}
#[doc = "Builder for the [Autoscaling Put Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/autoscaling-put-autoscaling-policy.html)\n\nCreates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[doc = "Builder for the [Autoscaling Put Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-put-autoscaling-policy.html)\n\nCreates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[derive(Clone, Debug)]
pub struct AutoscalingPutAutoscalingPolicy<'a, 'b, B> {
transport: &'a Transport,
Expand Down Expand Up @@ -550,25 +550,25 @@ impl<'a> Autoscaling<'a> {
pub fn transport(&self) -> &Transport {
self.transport
}
#[doc = "[Autoscaling Delete Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/autoscaling-delete-autoscaling-policy.html)\n\nDeletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[doc = "[Autoscaling Delete Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-delete-autoscaling-policy.html)\n\nDeletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
pub fn delete_autoscaling_policy<'b>(
&'a self,
parts: AutoscalingDeleteAutoscalingPolicyParts<'b>,
) -> AutoscalingDeleteAutoscalingPolicy<'a, 'b> {
AutoscalingDeleteAutoscalingPolicy::new(self.transport(), parts)
}
#[doc = "[Autoscaling Get Autoscaling Capacity API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/autoscaling-get-autoscaling-capacity.html)\n\nGets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[doc = "[Autoscaling Get Autoscaling Capacity API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-get-autoscaling-capacity.html)\n\nGets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
pub fn get_autoscaling_capacity<'b>(&'a self) -> AutoscalingGetAutoscalingCapacity<'a, 'b> {
AutoscalingGetAutoscalingCapacity::new(self.transport())
}
#[doc = "[Autoscaling Get Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/autoscaling-get-autoscaling-policy.html)\n\nRetrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[doc = "[Autoscaling Get Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-get-autoscaling-policy.html)\n\nRetrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
pub fn get_autoscaling_policy<'b>(
&'a self,
parts: AutoscalingGetAutoscalingPolicyParts<'b>,
) -> AutoscalingGetAutoscalingPolicy<'a, 'b> {
AutoscalingGetAutoscalingPolicy::new(self.transport(), parts)
}
#[doc = "[Autoscaling Put Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/autoscaling-put-autoscaling-policy.html)\n\nCreates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
#[doc = "[Autoscaling Put Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-put-autoscaling-policy.html)\n\nCreates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."]
pub fn put_autoscaling_policy<'b>(
&'a self,
parts: AutoscalingPutAutoscalingPolicyParts<'b>,
Expand Down
Loading

0 comments on commit 1b469ae

Please sign in to comment.