diff --git a/CHANGELOG.md b/CHANGELOG.md index 89fb4b9..aab90da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Breaking + +- The `create bucket` flag `--transform-tag` is now removed. + # v0.25.0 - Fixes issue when getting streams that have multiple filters on single user property - Fixes issue where upper case file names would not be matched in `parse` diff --git a/api/src/lib.rs b/api/src/lib.rs index efac26d..ec4be82 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -91,7 +91,7 @@ pub use crate::{ resources::{ bucket::{ Bucket, BucketType, FullName as BucketFullName, Id as BucketId, - Identifier as BucketIdentifier, Name as BucketName, NewBucket, TransformTag, + Identifier as BucketIdentifier, Name as BucketName, NewBucket, }, comment::{ AnnotatedComment, Comment, CommentFilter, CommentsIterPage, Continuation, @@ -120,7 +120,7 @@ pub use crate::{ project::{NewProject, Project, ProjectName, UpdateProject}, source::{ FullName as SourceFullName, Id as SourceId, Identifier as SourceIdentifier, - Name as SourceName, NewSource, Source, SourceKind, UpdateSource, + Name as SourceName, NewSource, Source, SourceKind, TransformTag, UpdateSource, }, statistics::Statistics as CommentStatistics, stream::{ diff --git a/api/src/resources/bucket.rs b/api/src/resources/bucket.rs index 9a95bfe..15826d0 100644 --- a/api/src/resources/bucket.rs +++ b/api/src/resources/bucket.rs @@ -19,8 +19,6 @@ pub struct Bucket { pub name: Name, pub owner: Username, pub created_at: DateTime, - #[serde(default)] - pub transform_tag: Option, } impl Bucket { @@ -41,17 +39,6 @@ pub struct Id(pub String); #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, Hash)] pub struct ModelFamily(pub String); -#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, Hash)] -pub struct TransformTag(pub String); - -impl FromStr for TransformTag { - type Err = Error; - - fn from_str(string: &str) -> Result { - Ok(Self(string.to_owned())) - } -} - // TODO(mcobzarenco)[3963]: Make `Identifier` into a trait (ensure it still implements // `FromStr` so we can take T: Identifier as a clap command line argument). #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, Hash)] @@ -114,7 +101,6 @@ pub struct NewBucket<'request> { pub bucket_type: BucketType, #[serde(skip_serializing_if = "Option::is_none")] pub title: Option<&'request str>, - pub transform_tag: &'request TransformTag, } #[derive(Debug, Clone, Serialize, PartialEq, Eq)] diff --git a/api/src/resources/source.rs b/api/src/resources/source.rs index ab7f508..14cda5a 100644 --- a/api/src/resources/source.rs +++ b/api/src/resources/source.rs @@ -9,11 +9,21 @@ use std::{ use crate::{ error::{Error, Result}, resources::bucket::Id as BucketId, - resources::bucket::TransformTag, resources::user::Username, CommentFilter, }; +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, Hash)] +pub struct TransformTag(pub String); + +impl FromStr for TransformTag { + type Err = Error; + + fn from_str(string: &str) -> Result { + Ok(Self(string.to_owned())) + } +} + #[derive(Debug, Clone, Serialize, Default)] pub struct StatisticsRequestParams { pub comment_filter: CommentFilter, diff --git a/cli/src/commands/create/bucket.rs b/cli/src/commands/create/bucket.rs index fb173f0..8499fad 100644 --- a/cli/src/commands/create/bucket.rs +++ b/cli/src/commands/create/bucket.rs @@ -1,7 +1,7 @@ -use crate::{commands::DEFAULT_TRANSFORM_TAG, printer::Printer}; +use crate::printer::Printer; use anyhow::{Context, Result}; use log::info; -use reinfer_client::{BucketFullName, BucketType, Client, NewBucket, TransformTag}; +use reinfer_client::{BucketFullName, BucketType, Client, NewBucket}; use structopt::StructOpt; #[derive(Debug, StructOpt)] @@ -17,11 +17,6 @@ pub struct CreateBucketArgs { #[structopt(default_value, long = "type")] /// Set the type of the new bucket. Currently, this must be "emails". bucket_type: BucketType, - - #[structopt(long = "transform-tag")] - /// Set the transform tag of the new bucket. You will be given this value - /// by a Re:infer engineer. - transform_tag: Option, } pub fn create(client: &Client, args: &CreateBucketArgs, printer: &Printer) -> Result<()> { @@ -29,27 +24,21 @@ pub fn create(client: &Client, args: &CreateBucketArgs, printer: &Printer) -> Re name, title, bucket_type, - transform_tag, } = args; - let transform_tag = transform_tag - .clone() - .unwrap_or(DEFAULT_TRANSFORM_TAG.clone()); - let bucket = client .create_bucket( name, NewBucket { title: title.as_deref(), bucket_type: *bucket_type, - transform_tag: &transform_tag, }, ) .context("Operation to create a bucket has failed")?; info!( "New bucket `{}` [id: {}] created successfully", bucket.full_name(), - bucket.id + bucket.id, ); printer.print_resources(&[bucket])?; Ok(()) diff --git a/cli/src/printer.rs b/cli/src/printer.rs index 679e912..3ff8a9f 100644 --- a/cli/src/printer.rs +++ b/cli/src/printer.rs @@ -79,7 +79,7 @@ impl DisplayTable for Integration { } impl DisplayTable for Bucket { fn to_table_headers() -> Row { - row![bFg => "Name", "ID", "Created (UTC)", "Transform Tag"] + row![bFg => "Name", "ID", "Created (UTC)"] } fn to_table_row(&self) -> Row { @@ -88,10 +88,6 @@ impl DisplayTable for Bucket { full_name, self.id.0, self.created_at.format("%Y-%m-%d %H:%M:%S"), - match &self.transform_tag { - Some(transform_tag) => transform_tag.0.as_str().into(), - None => "missing".dimmed(), - } ] } } @@ -201,7 +197,7 @@ pub struct PrintableBucket { } impl DisplayTable for PrintableBucket { fn to_table_headers() -> Row { - row![bFg => "Name", "ID", "Created (UTC)", "Transform Tag", "Num Emails"] + row![bFg => "Name", "ID", "Created (UTC)", "Num Emails"] } fn to_table_row(&self) -> Row { @@ -215,10 +211,6 @@ impl DisplayTable for PrintableBucket { full_name, self.bucket.id.0, self.bucket.created_at.format("%Y-%m-%d %H:%M:%S"), - match &self.bucket.transform_tag { - Some(transform_tag) => transform_tag.0.as_str().into(), - None => "missing".dimmed(), - }, if let Some(stats) = &self.stats { stats.count.to_string().as_str().into() } else { diff --git a/cli/tests/test_buckets.rs b/cli/tests/test_buckets.rs index 63546d2..0159ad1 100644 --- a/cli/tests/test_buckets.rs +++ b/cli/tests/test_buckets.rs @@ -9,13 +9,7 @@ fn test_bucket_lifecycle() { let new_bucket_name = format!("{}/test-source-{}", owner, Uuid::new_v4()); // Create bucket - let output = cli.run([ - "create", - "bucket", - &new_bucket_name, - "--transform-tag", - "generic_simple.0.QR5PW4VZ", - ]); + let output = cli.run(["create", "bucket", &new_bucket_name]); assert!(output.contains(&new_bucket_name), "{}", output); let output = cli.run(["get", "buckets"]); @@ -29,40 +23,11 @@ fn test_bucket_lifecycle() { assert!(!output.contains(&new_bucket_name), "{}", output); } -#[test] -fn test_bucket_with_invalid_transform_tag_fails() { - let cli = TestCli::get(); - let owner = TestCli::project(); - - let new_bucket_name = format!("{}/test-source-{}", owner, Uuid::new_v4()); - - let output = cli.run_and_error([ - "create", - "bucket", - &new_bucket_name, - "--transform-tag", - "not-a-valid-transform-tag.0.ABCDEFGH", - ]); - assert!( - output.contains( - "422 Unprocessable Entity: The value 'not-a-valid-transform-tag.0.ABCDEFGH' is not a valid transform tag." - ), - "{}", - output, - ); -} - #[test] fn test_create_without_org_fails() { let cli = TestCli::get(); - let output = cli.run_and_error([ - "create", - "bucket", - "bucket-name-without-org", - "--transform-tag", - "generic_simple.0.QR5PW4VZ", - ]); + let output = cli.run_and_error(["create", "bucket", "bucket-name-without-org"]); assert!( output.contains("Expected /, got: bucket-name-without-org"), "{}", @@ -74,13 +39,7 @@ fn test_create_without_org_fails() { fn test_create_with_empty_org_fails() { let cli = TestCli::get(); - let output = cli.run_and_error([ - "create", - "bucket", - "/bucket-name-with-empty-org", - "--transform-tag", - "generic_simple.0.QR5PW4VZ", - ]); + let output = cli.run_and_error(["create", "bucket", "/bucket-name-with-empty-org"]); assert!( output.contains("Expected /, got: /bucket-name-with-empty-org"), "{}", @@ -92,13 +51,7 @@ fn test_create_with_empty_org_fails() { fn test_create_with_empty_bucket_name_fails() { let cli = TestCli::get(); - let output = cli.run_and_error([ - "create", - "bucket", - "org-without-bucket-name/", - "--transform-tag", - "generic_simple.0.QR5PW4VZ", - ]); + let output = cli.run_and_error(["create", "bucket", "org-without-bucket-name/"]); assert!( output.contains("Expected /, got: org-without-bucket-name/"), "{}", @@ -110,13 +63,7 @@ fn test_create_with_empty_bucket_name_fails() { fn test_create_with_too_many_seperators_fails() { let cli = TestCli::get(); - let output = cli.run_and_error([ - "create", - "bucket", - "Bucket/Name/with/too/many/seperators/", - "--transform-tag", - "generic_simple.0.QR5PW4VZ", - ]); + let output = cli.run_and_error(["create", "bucket", "Bucket/Name/with/too/many/seperators/"]); assert!( output.contains("Expected /, got: Bucket/Name/with/too/many/seperators"), "{}",