Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions src/commands/authn_mappings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::formatter;
use crate::util;

pub async fn list(cfg: &Config) -> Result<()> {
let api = crate::make_api_no_auth!(AuthNMappingsAPI, cfg);
let api = crate::make_api!(AuthNMappingsAPI, cfg);
Comment thread
platinummonkey marked this conversation as resolved.
Comment thread
platinummonkey marked this conversation as resolved.
let resp = api
.list_authn_mappings(ListAuthNMappingsOptionalParams::default())
.await
Expand All @@ -18,7 +18,7 @@ pub async fn list(cfg: &Config) -> Result<()> {
}

pub async fn get(cfg: &Config, mapping_id: &str) -> Result<()> {
let api = crate::make_api_no_auth!(AuthNMappingsAPI, cfg);
let api = crate::make_api!(AuthNMappingsAPI, cfg);
let resp = api
.get_authn_mapping(mapping_id.to_string())
.await
Expand All @@ -28,7 +28,7 @@ pub async fn get(cfg: &Config, mapping_id: &str) -> Result<()> {

pub async fn create(cfg: &Config, file: &str) -> Result<()> {
let body: AuthNMappingCreateRequest = util::read_json_file(file)?;
let api = crate::make_api_no_auth!(AuthNMappingsAPI, cfg);
let api = crate::make_api!(AuthNMappingsAPI, cfg);
let resp = api
.create_authn_mapping(body)
.await
Expand All @@ -38,7 +38,7 @@ pub async fn create(cfg: &Config, file: &str) -> Result<()> {

pub async fn update(cfg: &Config, mapping_id: &str, file: &str) -> Result<()> {
let body: AuthNMappingUpdateRequest = util::read_json_file(file)?;
let api = crate::make_api_no_auth!(AuthNMappingsAPI, cfg);
let api = crate::make_api!(AuthNMappingsAPI, cfg);
let resp = api
.update_authn_mapping(mapping_id.to_string(), body)
.await
Expand All @@ -47,7 +47,7 @@ pub async fn update(cfg: &Config, mapping_id: &str, file: &str) -> Result<()> {
}

pub async fn delete(cfg: &Config, mapping_id: &str) -> Result<()> {
let api = crate::make_api_no_auth!(AuthNMappingsAPI, cfg);
let api = crate::make_api!(AuthNMappingsAPI, cfg);
api.delete_authn_mapping(mapping_id.to_string())
.await
.map_err(|e| anyhow::anyhow!("failed to delete AuthN mapping: {e:?}"))?;
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,10 @@ enum Commands {
///
/// AUTHENTICATION:
/// Requires either OAuth2 authentication or API keys.
/// list/get work with default OAuth scopes. create/update/delete
/// require the user_access_manage scope, which is not requested by
/// default -- opt in with:
/// pup auth login --extra-scopes user_access_manage
#[command(name = "authn-mappings", verbatim_doc_comment)]
AuthnMappings {
#[command(subcommand)]
Expand Down