Skip to content

Commit

Permalink
add support for listing system containers when listing containers (#1362
Browse files Browse the repository at this point in the history
)

From the documentation:
> -system: Version 2020-10-02 and later. Specifies if system containers are to be included in the response. Including this option will list system containers, such as $logs and $changefeed. Note that the specific system containers returned will vary, based on which service features are enabled on the storage account.

ref: https://learn.microsoft.com/en-us/rest/api/storageservices/list-containers2?tabs=azure-ad
  • Loading branch information
demoray committed Sep 8, 2023
1 parent 4980dbd commit 5ff5fe3
Show file tree
Hide file tree
Showing 105 changed files with 421 additions and 410 deletions.
2 changes: 1 addition & 1 deletion eng/scripts/emulator_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cd $(dirname ${BASH_SOURCE[0]})/../../

BUILD=${1:-stable}

npm install azurite@3.13.1
npm install azurite@3.26.0
npx azurite &

rustup update --no-self-update ${BUILD}
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/src/clients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub const EMULATOR_ACCOUNT: &str = "devstoreaccount1";
pub const EMULATOR_ACCOUNT_KEY: &str =
"Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==";

const AZURE_VERSION: HeaderValue = HeaderValue::from_static("2019-12-12");
const AZURE_VERSION: HeaderValue = HeaderValue::from_static("2020-10-02");

#[derive(Debug, Clone, Copy)]
pub enum ServiceType {
Expand Down
24 changes: 17 additions & 7 deletions sdk/storage_blobs/src/service/operations/list_containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub struct ListContainersBuilder {
prefix: Option<Prefix>,
include_metadata: bool,
include_deleted: bool,
include_system: bool,
max_results: Option<MaxResults>,
context: Context,
}
Expand All @@ -26,6 +27,7 @@ impl ListContainersBuilder {
prefix: None,
include_metadata: false,
include_deleted: false,
include_system: false,
max_results: None,
context: Context::new(),
}
Expand All @@ -35,6 +37,7 @@ impl ListContainersBuilder {
prefix: Prefix => Some(prefix),
include_metadata: bool => include_metadata,
include_deleted: bool => include_deleted,
include_system: bool => include_system,
max_results: MaxResults => Some(max_results),
context: Context => context,
}
Expand All @@ -54,13 +57,20 @@ impl ListContainersBuilder {
next_marker.append_to_url_query(&mut url);
}

if let Some(include) = match (this.include_metadata, this.include_deleted) {
(true, true) => Some("metadata,deleted"),
(true, false) => Some("metadata"),
(false, true) => Some("deleted"),
(false, false) => None,
} {
url.query_pairs_mut().append_pair("include", include);
let mut to_include = vec![];

if this.include_metadata {
to_include.push("metadata");
}
if this.include_deleted {
to_include.push("deleted");
}
if this.include_system {
to_include.push("system");
}
if !to_include.is_empty() {
url.query_pairs_mut()
.append_pair("include", &to_include.join(","));
}
this.max_results.append_to_url_query(&mut url);

Expand Down
6 changes: 3 additions & 3 deletions test/transactions/datalake_file_create_delete/0_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"headers": {
"authorization": "<<STRIPPED>>",
"content-length": "0",
"user-agent": "azsdk-rust-storage_datalake/0.1.0 (1.58.0; linux; x86_64)",
"x-ms-date": "Tue, 08 Feb 2022 19:19:33 GMT",
"x-ms-version": "2019-12-12"
"user-agent": "azsdk-rust-storage/0.14.0 (1.72.0; linux; x86_64)",
"x-ms-date": "Thu, 07 Sep 2023 19:20:13 GMT",
"x-ms-version": "2020-10-02"
},
"body": ""
}
10 changes: 5 additions & 5 deletions test/transactions/datalake_file_create_delete/0_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"status": 201,
"headers": {
"content-length": "0",
"date": "Tue, 08 Feb 2022 19:19:34 GMT",
"etag": "\"0x8D9EB37F12127AD\"",
"last-modified": "Tue, 08 Feb 2022 19:19:35 GMT",
"date": "Thu, 07 Sep 2023 19:20:13 GMT",
"etag": "\"0x8DBAFD776AA95E2\"",
"last-modified": "Thu, 07 Sep 2023 19:20:14 GMT",
"server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-namespace-enabled": "true",
"x-ms-request-id": "c47a931d-801f-0017-7920-1d865a000000",
"x-ms-version": "2019-12-12"
"x-ms-request-id": "e1ea9c5d-501f-001c-0ac0-e1106d000000",
"x-ms-version": "2020-10-02"
},
"body": ""
}
6 changes: 3 additions & 3 deletions test/transactions/datalake_file_create_delete/1_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"headers": {
"authorization": "<<STRIPPED>>",
"content-length": "0",
"user-agent": "azsdk-rust-storage_datalake/0.1.0 (1.58.0; linux; x86_64)",
"x-ms-date": "Tue, 08 Feb 2022 19:19:33 GMT",
"x-ms-version": "2019-12-12"
"user-agent": "azsdk-rust-storage/0.14.0 (1.72.0; linux; x86_64)",
"x-ms-date": "Thu, 07 Sep 2023 19:20:13 GMT",
"x-ms-version": "2020-10-02"
},
"body": ""
}
10 changes: 5 additions & 5 deletions test/transactions/datalake_file_create_delete/1_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"status": 201,
"headers": {
"content-length": "0",
"date": "Tue, 08 Feb 2022 19:19:34 GMT",
"etag": "\"0x8D9EB37F16507E0\"",
"last-modified": "Tue, 08 Feb 2022 19:19:35 GMT",
"date": "Thu, 07 Sep 2023 19:20:13 GMT",
"etag": "\"0x8DBAFD776B883D6\"",
"last-modified": "Thu, 07 Sep 2023 19:20:14 GMT",
"server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-request-id": "c47a931e-801f-0017-7a20-1d865a000000",
"x-ms-request-id": "e1ea9c60-501f-001c-0dc0-e1106d000000",
"x-ms-request-server-encrypted": "true",
"x-ms-version": "2019-12-12"
"x-ms-version": "2020-10-02"
},
"body": ""
}
6 changes: 3 additions & 3 deletions test/transactions/datalake_file_create_delete/2_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"authorization": "<<STRIPPED>>",
"content-length": "0",
"if-none-match": "*",
"user-agent": "azsdk-rust-storage_datalake/0.1.0 (1.58.0; linux; x86_64)",
"x-ms-date": "Tue, 08 Feb 2022 19:19:34 GMT",
"x-ms-version": "2019-12-12"
"user-agent": "azsdk-rust-storage/0.14.0 (1.72.0; linux; x86_64)",
"x-ms-date": "Thu, 07 Sep 2023 19:20:13 GMT",
"x-ms-version": "2020-10-02"
},
"body": ""
}
8 changes: 4 additions & 4 deletions test/transactions/datalake_file_create_delete/2_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"headers": {
"content-length": "168",
"content-type": "application/json;charset=utf-8",
"date": "Tue, 08 Feb 2022 19:19:34 GMT",
"date": "Thu, 07 Sep 2023 19:20:13 GMT",
"server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-error-code": "PathAlreadyExists",
"x-ms-request-id": "c47a931f-801f-0017-7b20-1d865a000000",
"x-ms-version": "2019-12-12"
"x-ms-request-id": "e1ea9c65-501f-001c-12c0-e1106d000000",
"x-ms-version": "2020-10-02"
},
"body": "eyJlcnJvciI6eyJjb2RlIjoiUGF0aEFscmVhZHlFeGlzdHMiLCJtZXNzYWdlIjoiVGhlIHNwZWNpZmllZCBwYXRoIGFscmVhZHkgZXhpc3RzLlxuUmVxdWVzdElkOmM0N2E5MzFmLTgwMWYtMDAxNy03YjIwLTFkODY1YTAwMDAwMFxuVGltZToyMDIyLTAyLTA4VDE5OjE5OjM1Ljc4MzQxMDJaIn19"
"body": "eyJlcnJvciI6eyJjb2RlIjoiUGF0aEFscmVhZHlFeGlzdHMiLCJtZXNzYWdlIjoiVGhlIHNwZWNpZmllZCBwYXRoIGFscmVhZHkgZXhpc3RzLlxuUmVxdWVzdElkOmUxZWE5YzY1LTUwMWYtMDAxYy0xMmMwLWUxMTA2ZDAwMDAwMFxuVGltZToyMDIzLTA5LTA3VDE5OjIwOjE0Ljc5OTY4OTdaIn19"
}
6 changes: 3 additions & 3 deletions test/transactions/datalake_file_create_delete/3_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"headers": {
"authorization": "<<STRIPPED>>",
"content-length": "0",
"user-agent": "azsdk-rust-storage_datalake/0.1.0 (1.58.0; linux; x86_64)",
"x-ms-date": "Tue, 08 Feb 2022 19:19:34 GMT",
"x-ms-version": "2019-12-12"
"user-agent": "azsdk-rust-storage/0.14.0 (1.72.0; linux; x86_64)",
"x-ms-date": "Thu, 07 Sep 2023 19:20:13 GMT",
"x-ms-version": "2020-10-02"
},
"body": ""
}
10 changes: 5 additions & 5 deletions test/transactions/datalake_file_create_delete/3_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"status": 201,
"headers": {
"content-length": "0",
"date": "Tue, 08 Feb 2022 19:19:35 GMT",
"etag": "\"0x8D9EB37F1AE3D1F\"",
"last-modified": "Tue, 08 Feb 2022 19:19:36 GMT",
"date": "Thu, 07 Sep 2023 19:20:13 GMT",
"etag": "\"0x8DBAFD776C1852D\"",
"last-modified": "Thu, 07 Sep 2023 19:20:14 GMT",
"server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-request-id": "c47a9320-801f-0017-7c20-1d865a000000",
"x-ms-request-id": "e1ea9c69-501f-001c-16c0-e1106d000000",
"x-ms-request-server-encrypted": "true",
"x-ms-version": "2019-12-12"
"x-ms-version": "2020-10-02"
},
"body": ""
}
8 changes: 4 additions & 4 deletions test/transactions/datalake_file_create_delete/4_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"uri": "/azurerustsdk-datalake-file-create-delete/some/path/e2etest-file.txt",
"method": "DELETE",
"headers": {
"content-length": "0",
"authorization": "<<STRIPPED>>",
"user-agent": "azsdk-rust-storage_datalake/0.1.0 (1.58.0; linux; x86_64)",
"x-ms-date": "Tue, 08 Feb 2022 19:19:34 GMT",
"x-ms-version": "2019-12-12"
"content-length": "0",
"user-agent": "azsdk-rust-storage/0.14.0 (1.72.0; linux; x86_64)",
"x-ms-date": "Thu, 07 Sep 2023 19:20:13 GMT",
"x-ms-version": "2020-10-02"
},
"body": ""
}
8 changes: 5 additions & 3 deletions test/transactions/datalake_file_create_delete/4_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"status": 200,
"headers": {
"content-length": "0",
"date": "Tue, 08 Feb 2022 19:19:35 GMT",
"date": "Thu, 07 Sep 2023 19:20:14 GMT",
"server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-request-id": "c47a9321-801f-0017-7d20-1d865a000000",
"x-ms-version": "2019-12-12"
"x-ms-delete-type-permanent": "false",
"x-ms-deletion-id": "133385880149270997",
"x-ms-request-id": "e1ea9c6a-501f-001c-17c0-e1106d000000",
"x-ms-version": "2020-10-02"
},
"body": ""
}
6 changes: 3 additions & 3 deletions test/transactions/datalake_file_create_delete/5_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"headers": {
"authorization": "<<STRIPPED>>",
"content-length": "0",
"user-agent": "azsdk-rust-storage_datalake/0.1.0 (1.58.0; linux; x86_64)",
"x-ms-date": "Tue, 08 Feb 2022 19:19:34 GMT",
"x-ms-version": "2019-12-12"
"user-agent": "azsdk-rust-storage/0.14.0 (1.72.0; linux; x86_64)",
"x-ms-date": "Thu, 07 Sep 2023 19:20:14 GMT",
"x-ms-version": "2020-10-02"
},
"body": ""
}
6 changes: 3 additions & 3 deletions test/transactions/datalake_file_create_delete/5_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"status": 202,
"headers": {
"content-length": "0",
"date": "Tue, 08 Feb 2022 19:19:37 GMT",
"date": "Thu, 07 Sep 2023 19:20:14 GMT",
"server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-request-id": "c47a9322-801f-0017-7e20-1d865a000000",
"x-ms-version": "2019-12-12"
"x-ms-request-id": "e1ea9c75-501f-001c-22c0-e1106d000000",
"x-ms-version": "2020-10-02"
},
"body": ""
}
6 changes: 3 additions & 3 deletions test/transactions/datalake_file_properties/0_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"headers": {
"authorization": "<<STRIPPED>>",
"content-length": "0",
"user-agent": "azsdk-rust-storage_datalake/0.1.1 (1.59.0; linux; x86_64)",
"x-ms-date": "Mon, 11 Apr 2022 16:19:46 GMT",
"x-ms-version": "2019-12-12"
"user-agent": "azsdk-rust-storage/0.14.0 (1.72.0; linux; x86_64)",
"x-ms-date": "Thu, 07 Sep 2023 19:20:13 GMT",
"x-ms-version": "2020-10-02"
},
"body": ""
}
10 changes: 5 additions & 5 deletions test/transactions/datalake_file_properties/0_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"status": 201,
"headers": {
"content-length": "0",
"date": "Mon, 11 Apr 2022 16:19:47 GMT",
"etag": "\"0x8DA1BD718A4B558\"",
"last-modified": "Mon, 11 Apr 2022 16:19:47 GMT",
"date": "Thu, 07 Sep 2023 19:20:13 GMT",
"etag": "\"0x8DBAFD7768F9ED6\"",
"last-modified": "Thu, 07 Sep 2023 19:20:14 GMT",
"server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-namespace-enabled": "true",
"x-ms-request-id": "def5aa2e-901f-0073-67bf-4d3635000000",
"x-ms-version": "2019-12-12"
"x-ms-request-id": "b04cf714-c01f-0053-08c0-e16139000000",
"x-ms-version": "2020-10-02"
},
"body": ""
}
6 changes: 3 additions & 3 deletions test/transactions/datalake_file_properties/1_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"headers": {
"authorization": "<<STRIPPED>>",
"content-length": "0",
"user-agent": "azsdk-rust-storage_datalake/0.1.1 (1.59.0; linux; x86_64)",
"x-ms-date": "Mon, 11 Apr 2022 16:19:47 GMT",
"x-ms-version": "2019-12-12"
"user-agent": "azsdk-rust-storage/0.14.0 (1.72.0; linux; x86_64)",
"x-ms-date": "Thu, 07 Sep 2023 19:20:13 GMT",
"x-ms-version": "2020-10-02"
},
"body": ""
}
10 changes: 5 additions & 5 deletions test/transactions/datalake_file_properties/1_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"status": 201,
"headers": {
"content-length": "0",
"date": "Mon, 11 Apr 2022 16:19:47 GMT",
"etag": "\"0x8DA1BD718F18E95\"",
"last-modified": "Mon, 11 Apr 2022 16:19:47 GMT",
"date": "Thu, 07 Sep 2023 19:20:13 GMT",
"etag": "\"0x8DBAFD776A208C3\"",
"last-modified": "Thu, 07 Sep 2023 19:20:14 GMT",
"server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-request-id": "def5aa30-901f-0073-69bf-4d3635000000",
"x-ms-request-id": "b04cf71c-c01f-0053-10c0-e16139000000",
"x-ms-request-server-encrypted": "true",
"x-ms-version": "2019-12-12"
"x-ms-version": "2020-10-02"
},
"body": ""
}
6 changes: 3 additions & 3 deletions test/transactions/datalake_file_properties/2_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"headers": {
"authorization": "<<STRIPPED>>",
"content-length": "0",
"user-agent": "azsdk-rust-storage_datalake/0.1.1 (1.59.0; linux; x86_64)",
"x-ms-date": "Mon, 11 Apr 2022 16:19:47 GMT",
"user-agent": "azsdk-rust-storage/0.14.0 (1.72.0; linux; x86_64)",
"x-ms-date": "Thu, 07 Sep 2023 19:20:13 GMT",
"x-ms-properties": "AddedVia=QXp1cmUgU0RLIGZvciBSdXN0",
"x-ms-version": "2019-12-12"
"x-ms-version": "2020-10-02"
},
"body": ""
}
10 changes: 5 additions & 5 deletions test/transactions/datalake_file_properties/2_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"status": 201,
"headers": {
"content-length": "0",
"date": "Mon, 11 Apr 2022 16:19:47 GMT",
"etag": "\"0x8DA1BD71918DC66\"",
"last-modified": "Mon, 11 Apr 2022 16:19:47 GMT",
"date": "Thu, 07 Sep 2023 19:20:13 GMT",
"etag": "\"0x8DBAFD776A72E8E\"",
"last-modified": "Thu, 07 Sep 2023 19:20:14 GMT",
"server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-request-id": "def5aa32-901f-0073-6bbf-4d3635000000",
"x-ms-request-id": "b04cf727-c01f-0053-1bc0-e16139000000",
"x-ms-request-server-encrypted": "true",
"x-ms-version": "2019-12-12"
"x-ms-version": "2020-10-02"
},
"body": ""
}
6 changes: 3 additions & 3 deletions test/transactions/datalake_file_properties/3_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"headers": {
"authorization": "<<STRIPPED>>",
"content-length": "0",
"user-agent": "azsdk-rust-storage_datalake/0.1.1 (1.59.0; linux; x86_64)",
"x-ms-date": "Mon, 11 Apr 2022 16:19:47 GMT",
"x-ms-version": "2019-12-12"
"user-agent": "azsdk-rust-storage/0.14.0 (1.72.0; linux; x86_64)",
"x-ms-date": "Thu, 07 Sep 2023 19:20:13 GMT",
"x-ms-version": "2020-10-02"
},
"body": ""
}
10 changes: 5 additions & 5 deletions test/transactions/datalake_file_properties/3_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"accept-ranges": "bytes",
"content-length": "0",
"content-type": "application/octet-stream",
"date": "Mon, 11 Apr 2022 16:19:48 GMT",
"etag": "\"0x8DA1BD71918DC66\"",
"last-modified": "Mon, 11 Apr 2022 16:19:47 GMT",
"date": "Thu, 07 Sep 2023 19:20:13 GMT",
"etag": "\"0x8DBAFD776A72E8E\"",
"last-modified": "Thu, 07 Sep 2023 19:20:14 GMT",
"server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-content-crc64": "AAAAAAAAAAA=",
"x-ms-group": "$superuser",
Expand All @@ -15,10 +15,10 @@
"x-ms-owner": "$superuser",
"x-ms-permissions": "rw-r-----",
"x-ms-properties": "AddedVia=QXp1cmUgU0RLIGZvciBSdXN0",
"x-ms-request-id": "def5aa4e-901f-0073-76bf-4d3635000000",
"x-ms-request-id": "b04cf72b-c01f-0053-1fc0-e16139000000",
"x-ms-resource-type": "file",
"x-ms-server-encrypted": "true",
"x-ms-version": "2019-12-12"
"x-ms-version": "2020-10-02"
},
"body": ""
}
Loading

0 comments on commit 5ff5fe3

Please sign in to comment.