Skip to content

Commit d5fb4f5

Browse files
authored
Merge pull request #674 from fortanix/mz/use-v4-apis-by-default
dcap-artifact-retrieval: Use v4 APIs by default in CLI tool.
2 parents 01df9c5 + fd11714 commit d5fb4f5

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

intel-sgx/dcap-artifact-retrieval/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dcap-artifact-retrieval"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
authors = ["Fortanix, Inc."]
55
license = "MPL-2.0"
66
edition = "2018"

intel-sgx/dcap-artifact-retrieval/src/cli.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ use crate::{
1919
PccsProvisioningClientBuilder, PcsVersion, ProvisioningClient, StatusCode,
2020
};
2121

22+
// NOTE: unfortunately these default values need to be repeated in arg
23+
// descriptions in `main`. Please keep them in sync.
24+
const DEFAULT_ORIGIN: &'static str = "intel";
25+
const DEFAULT_API_VERSION: &'static str = "4";
26+
2227
#[derive(Debug, Deserialize, Copy, Clone, Eq, PartialEq, Hash)]
2328
#[serde(rename_all = "kebab-case")]
2429
enum Origin {
@@ -149,27 +154,28 @@ pub fn main() {
149154
(
150155
@arg ORIGIN: --("origin") +takes_value
151156
validator(|s| parse_origin(s.as_str()).map(|_| ()))
152-
"Location from where artifacts need to be fetched. Options are: \"intel\" and \"azure\".\
153-
Note that Azure does not provide access to all artifacts. Intel will be contacted as a fallback (default: \"intel\")"
157+
"Origin for downloading artifacts. Options are: \"intel\", \"azure\" and \"pccs\". \
158+
Note that Azure does not provide access to all artifacts. Intel will be contacted as a fallback. \
159+
Default: \"intel\"."
154160
)
155161
(
156162
@arg PCKID_FILE: --("pckid-file") +takes_value +required requires("PCKID_FILE")
157163
validator(is_file)
158-
"File describing the PCK identity (outputted by PCKIDRetrievalTool)"
164+
"File describing the PCK identity (outputted by PCKIDRetrievalTool)."
159165
)
160166
(
161167
@arg OUTPUT_DIR: --("output-dir") +takes_value +required requires("OUTPUT_DIR")
162168
validator(is_directory)
163-
"Destination folder for data retrieved from Intel certification services"
169+
"Destination folder for storing downloaded artifacts."
164170
)
165171
(
166172
@arg API_VERSION: --("api-version") +takes_value
167173
validator(|s| parse_pcs_version(s.as_str()).map(|_| ()))
168-
"API version for provisioning service, supported values are 3 and 4 (default: 3)"
174+
"API version for provisioning service, supported values are 3 and 4. Default: \"4\"."
169175
)
170176
(
171177
@arg API_KEY: --("api-key") +takes_value
172-
"API key for authenticating with Intel provisioning service"
178+
"API key for authenticating with Intel provisioning service."
173179
)
174180
(
175181
@arg PCCS_URL: --("pccs-url") +takes_value required_if("ORIGIN", "pccs")
@@ -182,7 +188,7 @@ pub fn main() {
182188
)
183189
(
184190
@arg VERBOSE: -v --verbose
185-
"Print information of which files are fetched"
191+
"Print additional information abut files that are fetched."
186192
)
187193
)
188194
.get_matches();
@@ -193,11 +199,11 @@ pub fn main() {
193199
) {
194200
(Some(pckid_file), Some(output_dir)) => {
195201
let verboseness = matches.occurrences_of("VERBOSE");
196-
let api_version = parse_pcs_version(matches.value_of("API_VERSION").unwrap_or("3"))
202+
let api_version = parse_pcs_version(matches.value_of("API_VERSION").unwrap_or(DEFAULT_API_VERSION))
197203
.expect("validated");
198204

199205
let origin =
200-
parse_origin(matches.value_of("ORIGIN").unwrap_or("intel")).expect("validated");
206+
parse_origin(matches.value_of("ORIGIN").unwrap_or(DEFAULT_ORIGIN)).expect("validated");
201207

202208
let fetcher = match matches.is_present("INSECURE") {
203209
false => crate::reqwest_client(),

0 commit comments

Comments
 (0)