Skip to content
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

feat(cli): add remove bucket to update source #360

Merged
merged 2 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Unreleased
- Add --detach-bucket to `update source`

# v0.36.3
- Fix a typo in get datasets docs
- Allow for round tripping regex pattens in entity defs
Expand Down
1 change: 0 additions & 1 deletion api/src/resources/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ pub struct UpdateSource<'request> {
#[serde(skip_serializing_if = "Option::is_none")]
pub should_translate: Option<bool>,

#[serde(skip_serializing_if = "Option::is_none")]
pub bucket_id: Option<BucketId>,

#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
7 changes: 7 additions & 0 deletions cli/src/commands/update/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ pub struct UpdateSourceArgs {
#[structopt(long = "transform-tag")]
/// Set the transform tag of the source
transform_tag: Option<TransformTag>,

#[structopt(long = "detach-bucket")]
/// Detach bucket from source
detach_bucket: bool,
}

pub fn update(client: &Client, args: &UpdateSourceArgs, printer: &Printer) -> Result<()> {
Expand All @@ -39,6 +43,7 @@ pub fn update(client: &Client, args: &UpdateSourceArgs, printer: &Printer) -> Re
should_translate,
bucket,
transform_tag,
detach_bucket,
} = args;

let bucket_id = match bucket.to_owned() {
Expand All @@ -60,6 +65,8 @@ pub fn update(client: &Client, args: &UpdateSourceArgs, printer: &Printer) -> Re
.full_name(),
};

let bucket_id = if *detach_bucket { None } else { bucket_id };

let source = client
.update_source(
&source_full_name,
Expand Down
6 changes: 5 additions & 1 deletion cli/src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl DisplayTable for Project {

impl DisplayTable for Source {
fn to_table_headers() -> Row {
row![bFg => "Name", "ID", "Updated (UTC)", "Transform Tag", "Title"]
row![bFg => "Name", "ID", "Updated (UTC)", "Transform Tag", "Title", "Bucket"]
}

fn to_table_row(&self) -> Row {
Expand All @@ -208,6 +208,10 @@ impl DisplayTable for Source {
None => "missing".dimmed(),
},
self.title,
match &self.bucket_id {
Some(bucket) => bucket.0.as_str().into(),
None => "missing".dimmed(),
}
]
}
}
Expand Down
Loading