martindstone / pagerduty-cli

A command line interface for PagerDuty

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing: -j flag for pd schedule show

zerolaser opened this issue · comments

Missing the json flag for pd schedule show.

pd schedule show -i PDXXXX -j

 ›   See more help with --help

hi @zerolaser i had not done this because the output from pd schedule show -i ${id} --since '3 days ago' -j would be identical to the output from pd rest get -e schedules/${id} -P $(pd util timestamp 3 days ago) -- that said, it is an easy change and i will do it. Can you take a look at the output from pd rest get though and confirm that that is what you would be expecting to see?

@martindstone Tweaked your command to add since to get the results.
pd rest get -e schedules/${id} -P since=$(pd util timestamp 2022/09/05) And yes this is what I'm expecting to see.

Could you add a few more examples of pd rest in readme.md, I dint know how to use it until your example command.

All I need from the above command is list of Users in that schedule and check if a schedule has inactive users.

Hi @zerolaser I will definitely do that, it's on my todo list to redo the wiki... if you want all users participating in a schedule, rather than just users who have an on call shift in the specified time range, it is a little different. Are you just looking for deleted users that are part of a schedule rotation? Or are you maybe looking for upcoming on call shifts that have a deleted user assigned? If it's the former, you could do this with a simple python script. If it's the latter, the /oncalls endpoint may be a better choice for you:

pd rest fetch -e oncalls -P until=$(pd util timestamp in 7 days) -t -k escalation_policy.summary -k schedule.summary -k user.summary -k user.id -k user.deleted_at --filter user.deleted_at='.+'

This will fetch /oncalls from now until 7 days from now, display the results in a table including the EP, schedule and user name, and then filter looking for users who have a non-blank deleted_at key indicating that they were deleted.

Let me know if this is close to what you are looking to do, or if it's something else...

Hi @zerolaser I was doing some other stuff and I went ahead and put in that -j flag to schedule show for you, it's in the 0.1.6 RC build, I will be promoting to stable soon

Hi @zerolaser I have promoted 0.1.6 to stable, so I am going to close this issue now... Please reach out if you need anything else on this issue.