martindstone / pagerduty-cli

A command line interface for PagerDuty
MIT License
91 stars 12 forks source link

Support filtering users by contact country #59

Closed jedelson-pagerduty closed 1 year ago

jedelson-pagerduty commented 1 year ago

Problem Statement

Due to variability in SMS deliverability across countries, admins may want to be able to audit contact methods across the user base of their accounts filtering by country.

Proposed Solution

Add a new flag to pd user list which filters to only include users in a given country, identified by its ISO country code. This flag should support multiple values.

E.g.

pd user list --contact_country_code CA -- lists users with a Canadian phone number in either phone or SMS contacts.

Alternatives Considered

Once #57 is fixed, something similar is possible using the --filter flag, e.g. pd user list --filter "Contact sms=\\+351 "

This, however, is less-than-ideal since this doesn't enable differentiation between countries that share a country code, most significantly +1 is ambiguous, and because the filter flag looks for a regex, + has to be escaped.