mirror of
https://github.com/minio/minio-rs.git
synced 2025-12-06 15:26:51 +08:00
fixed incorrect renaming of listen_bucket_notification (#152)
This commit is contained in:
parent
20d8654e34
commit
9495c5dcce
@ -46,9 +46,9 @@ mod get_object_tagging;
|
|||||||
mod get_presigned_object_url;
|
mod get_presigned_object_url;
|
||||||
mod get_presigned_policy_form_data;
|
mod get_presigned_policy_form_data;
|
||||||
mod get_region;
|
mod get_region;
|
||||||
mod list_bucket_notification;
|
|
||||||
mod list_buckets;
|
mod list_buckets;
|
||||||
mod list_objects;
|
mod list_objects;
|
||||||
|
mod listen_bucket_notification;
|
||||||
mod put_bucket_encryption;
|
mod put_bucket_encryption;
|
||||||
mod put_bucket_lifecycle;
|
mod put_bucket_lifecycle;
|
||||||
mod put_bucket_notification;
|
mod put_bucket_notification;
|
||||||
@ -96,9 +96,9 @@ pub use get_object_tagging::*;
|
|||||||
pub use get_presigned_object_url::*;
|
pub use get_presigned_object_url::*;
|
||||||
pub use get_presigned_policy_form_data::*;
|
pub use get_presigned_policy_form_data::*;
|
||||||
pub use get_region::*;
|
pub use get_region::*;
|
||||||
pub use list_bucket_notification::*;
|
|
||||||
pub use list_buckets::*;
|
pub use list_buckets::*;
|
||||||
pub use list_objects::*;
|
pub use list_objects::*;
|
||||||
|
pub use listen_bucket_notification::*;
|
||||||
pub use put_bucket_encryption::*;
|
pub use put_bucket_encryption::*;
|
||||||
pub use put_bucket_lifecycle::*;
|
pub use put_bucket_lifecycle::*;
|
||||||
pub use put_bucket_notification::*;
|
pub use put_bucket_notification::*;
|
||||||
|
|||||||
@ -21,16 +21,16 @@ use crate::s3::multimap::{Multimap, MultimapExt};
|
|||||||
use crate::s3::{
|
use crate::s3::{
|
||||||
client::Client,
|
client::Client,
|
||||||
error::Error,
|
error::Error,
|
||||||
response::ListBucketNotificationResponse,
|
response::ListenBucketNotificationResponse,
|
||||||
types::{NotificationRecords, S3Api, S3Request, ToS3Request},
|
types::{NotificationRecords, S3Api, S3Request, ToS3Request},
|
||||||
utils::check_bucket_name,
|
utils::check_bucket_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Argument builder for
|
/// Argument builder for the [`ListenBucketNotification`](https://min.io/docs/minio/linux/developers/go/API.html#ListenBucketNotification)
|
||||||
/// [listen_bucket_notification()](crate::s3::client::Client::list_bucket_notification)
|
///
|
||||||
/// API.
|
/// This struct constructs the parameters required for the [`Client::listen_bucket_notification`](crate::s3::client::Client::listen_bucket_notification) method.
|
||||||
#[derive(Clone, Debug, Default)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct ListBucketNotification {
|
pub struct ListenBucketNotification {
|
||||||
client: Client,
|
client: Client,
|
||||||
|
|
||||||
extra_headers: Option<Multimap>,
|
extra_headers: Option<Multimap>,
|
||||||
@ -42,7 +42,7 @@ pub struct ListBucketNotification {
|
|||||||
events: Option<Vec<String>>,
|
events: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ListBucketNotification {
|
impl ListenBucketNotification {
|
||||||
pub fn new(client: Client, bucket: String) -> Self {
|
pub fn new(client: Client, bucket: String) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
@ -83,19 +83,19 @@ impl ListBucketNotification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl S3Api for ListBucketNotification {
|
impl S3Api for ListenBucketNotification {
|
||||||
type S3Response = (
|
type S3Response = (
|
||||||
ListBucketNotificationResponse,
|
ListenBucketNotificationResponse,
|
||||||
Box<dyn Stream<Item = Result<NotificationRecords, Error>> + Unpin + Send>,
|
Box<dyn Stream<Item = Result<NotificationRecords, Error>> + Unpin + Send>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToS3Request for ListBucketNotification {
|
impl ToS3Request for ListenBucketNotification {
|
||||||
fn to_s3request(self) -> Result<S3Request, Error> {
|
fn to_s3request(self) -> Result<S3Request, Error> {
|
||||||
{
|
{
|
||||||
check_bucket_name(&self.bucket, true)?;
|
check_bucket_name(&self.bucket, true)?;
|
||||||
if self.client.is_aws_host() {
|
if self.client.is_aws_host() {
|
||||||
return Err(Error::UnsupportedApi("ListBucketNotification".into()));
|
return Err(Error::UnsupportedApi("ListenBucketNotification".into()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,9 +70,9 @@ mod get_object_tagging;
|
|||||||
mod get_presigned_object_url;
|
mod get_presigned_object_url;
|
||||||
mod get_presigned_post_form_data;
|
mod get_presigned_post_form_data;
|
||||||
mod get_region;
|
mod get_region;
|
||||||
mod list_bucket_notification;
|
|
||||||
mod list_buckets;
|
mod list_buckets;
|
||||||
mod list_objects;
|
mod list_objects;
|
||||||
|
mod listen_bucket_notification;
|
||||||
mod put_bucket_encryption;
|
mod put_bucket_encryption;
|
||||||
mod put_bucket_lifecycle;
|
mod put_bucket_lifecycle;
|
||||||
mod put_bucket_notification;
|
mod put_bucket_notification;
|
||||||
|
|||||||
@ -16,13 +16,13 @@
|
|||||||
//! MinIO Extension API for S3 Buckets: ListenBucketNotification
|
//! MinIO Extension API for S3 Buckets: ListenBucketNotification
|
||||||
|
|
||||||
use super::Client;
|
use super::Client;
|
||||||
use crate::s3::builders::ListBucketNotification;
|
use crate::s3::builders::ListenBucketNotification;
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
/// Creates a [`ListBucketNotification`] request builder.
|
/// Creates a [`ListenBucketNotification`] request builder.
|
||||||
///
|
///
|
||||||
/// To execute the request, call [`ListBucketNotification::send()`](crate::s3::types::S3Api::send),
|
/// To execute the request, call [`ListenBucketNotification::send()`](crate::s3::types::S3Api::send),
|
||||||
/// which returns a tuple of [`ListBucketNotificationResponse`](crate::s3::response::ListBucketNotificationResponse) and a
|
/// which returns a tuple of [`ListenBucketNotificationResponse`](crate::s3::response::ListenBucketNotificationResponse) and a
|
||||||
/// stream of [`NotificationRecords`](crate::s3::types::NotificationRecords). The former contains the HTTP headers
|
/// stream of [`NotificationRecords`](crate::s3::types::NotificationRecords). The former contains the HTTP headers
|
||||||
/// returned by the server and the latter is a stream of notification
|
/// returned by the server and the latter is a stream of notification
|
||||||
/// records. In normal operation (when there are no errors), the stream
|
/// records. In normal operation (when there are no errors), the stream
|
||||||
@ -43,7 +43,7 @@ impl Client {
|
|||||||
/// async fn main() {
|
/// async fn main() {
|
||||||
/// let client: Client = Default::default(); // configure your client here
|
/// let client: Client = Default::default(); // configure your client here
|
||||||
/// let (_resp, mut event_stream) = client
|
/// let (_resp, mut event_stream) = client
|
||||||
/// .list_bucket_notification("bucket-name")
|
/// .listen_bucket_notification("bucket-name")
|
||||||
/// .send().await .unwrap();
|
/// .send().await .unwrap();
|
||||||
///
|
///
|
||||||
/// while let Some(event) = event_stream.next().await {
|
/// while let Some(event) = event_stream.next().await {
|
||||||
@ -53,7 +53,10 @@ impl Client {
|
|||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn list_bucket_notification<S: Into<String>>(&self, bucket: S) -> ListBucketNotification {
|
pub fn listen_bucket_notification<S: Into<String>>(
|
||||||
ListBucketNotification::new(self.clone(), bucket.into())
|
&self,
|
||||||
|
bucket: S,
|
||||||
|
) -> ListenBucketNotification {
|
||||||
|
ListenBucketNotification::new(self.clone(), bucket.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,9 +43,9 @@ mod get_object_retention;
|
|||||||
mod get_object_tagging;
|
mod get_object_tagging;
|
||||||
mod get_presigned_object_url;
|
mod get_presigned_object_url;
|
||||||
mod get_region;
|
mod get_region;
|
||||||
mod list_bucket_notification;
|
|
||||||
mod list_buckets;
|
mod list_buckets;
|
||||||
pub(crate) mod list_objects;
|
pub(crate) mod list_objects;
|
||||||
|
mod listen_bucket_notification;
|
||||||
mod put_bucket_encryption;
|
mod put_bucket_encryption;
|
||||||
mod put_bucket_lifecycle;
|
mod put_bucket_lifecycle;
|
||||||
mod put_bucket_notification;
|
mod put_bucket_notification;
|
||||||
@ -90,9 +90,9 @@ pub use get_object_retention::GetObjectRetentionResponse;
|
|||||||
pub use get_object_tagging::GetObjectTaggingResponse;
|
pub use get_object_tagging::GetObjectTaggingResponse;
|
||||||
pub use get_presigned_object_url::GetPresignedObjectUrlResponse;
|
pub use get_presigned_object_url::GetPresignedObjectUrlResponse;
|
||||||
pub use get_region::GetRegionResponse;
|
pub use get_region::GetRegionResponse;
|
||||||
pub use list_bucket_notification::ListBucketNotificationResponse;
|
|
||||||
pub use list_buckets::ListBucketsResponse;
|
pub use list_buckets::ListBucketsResponse;
|
||||||
pub use list_objects::ListObjectsResponse;
|
pub use list_objects::ListObjectsResponse;
|
||||||
|
pub use listen_bucket_notification::ListenBucketNotificationResponse;
|
||||||
pub use put_bucket_encryption::PutBucketEncryptionResponse;
|
pub use put_bucket_encryption::PutBucketEncryptionResponse;
|
||||||
pub use put_bucket_lifecycle::PutBucketLifecycleResponse;
|
pub use put_bucket_lifecycle::PutBucketLifecycleResponse;
|
||||||
pub use put_bucket_notification::PutBucketNotificationResponse;
|
pub use put_bucket_notification::PutBucketNotificationResponse;
|
||||||
|
|||||||
@ -26,10 +26,10 @@ use crate::s3::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Response of
|
/// Response of
|
||||||
/// [list_bucket_notification()](crate::s3::client::Client::list_bucket_notification)
|
/// [listen _bucket_notification()](crate::s3::client::Client::listen_bucket_notification)
|
||||||
/// API
|
/// API
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ListBucketNotificationResponse {
|
pub struct ListenBucketNotificationResponse {
|
||||||
/// HTTP headers returned by the server, containing metadata such as `Content-Type`, `ETag`, etc.
|
/// HTTP headers returned by the server, containing metadata such as `Content-Type`, `ETag`, etc.
|
||||||
pub headers: HeaderMap,
|
pub headers: HeaderMap,
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ pub struct ListBucketNotificationResponse {
|
|||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl FromS3Response
|
impl FromS3Response
|
||||||
for (
|
for (
|
||||||
ListBucketNotificationResponse,
|
ListenBucketNotificationResponse,
|
||||||
Box<dyn Stream<Item = Result<NotificationRecords, Error>> + Unpin + Send>,
|
Box<dyn Stream<Item = Result<NotificationRecords, Error>> + Unpin + Send>,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -81,7 +81,7 @@ impl FromS3Response
|
|||||||
));
|
));
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
ListBucketNotificationResponse {
|
ListenBucketNotificationResponse {
|
||||||
headers,
|
headers,
|
||||||
region: req.inner_region,
|
region: req.inner_region,
|
||||||
bucket: take_bucket(req.bucket)?,
|
bucket: take_bucket(req.bucket)?,
|
||||||
@ -45,7 +45,7 @@ async fn listen_bucket_notification() {
|
|||||||
|
|
||||||
let (_resp, mut event_stream) = ctx2
|
let (_resp, mut event_stream) = ctx2
|
||||||
.client
|
.client
|
||||||
.list_bucket_notification(&bucket_name2)
|
.listen_bucket_notification(&bucket_name2)
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user