infamousjoeg / cybr-cli

A "Swiss Army Knife" command-line interface (CLI) for easy human and non-human interaction with @CyberArk suite of products.
Apache License 2.0
71 stars 15 forks source link

Add options to get or list feature #227

Open jgkloek opened 3 weeks ago

jgkloek commented 3 weeks ago

Please consider adding features similar to the add function to the list or get functions: -a address string -s safe string -p platform-id string -u username string

Thank you

AndrewCopeland commented 3 weeks ago

@jgkloek Thanks for reaching out. I do not believe the list endpoint has the ability to scope down searching by specific fields like the ones you mentioned.

You could always use the --search or -s feature flag and use spaces to include address safe platform-id and username.

See the documentation below for information about how the search query parameter works. https://docs.cyberark.com/pam-self-hosted/Latest/en/Content/SDK/GetAccounts.htm?tocpath=Developer%7CREST%20APIs%7CAccounts%7C_____1#Filter

An example would be:

cybr accounts list --search "<address> <safe> <platform-id> <username>"

@infamousjoeg are my assumptions correct?

jgkloek commented 1 week ago

Thank you very much. I did not know we could include multiple items in the search. I should have tried it. It works fine. I appreciate it.

I got my expected output and would like to ask one more question. I understand if it is not appropriate for this thread:

I’d like to get the id field in the output using jq. I’ve tried many different iterations but am just not able to wrangle it.

I know I can do it with sed, but jq is built specifically for handling json output. Would you please consider sharing the proper syntax?

Thank you again!

Jeffrey Kloek, President

Northeast Police Precinct Ambassadors

5139 Chiswood Cove

Memphis, TN 38134

901-386-5712 Home

901-233-6817 Cell

From: Andrew Copeland @.> Sent: Friday, September 27, 2024 11:00 AM To: infamousjoeg/cybr-cli @.> Cc: jgkloek @.>; Mention @.> Subject: Re: [infamousjoeg/cybr-cli] Add options to get or list feature (Issue #227)

@jgkloek https://github.com/jgkloek Thanks for reaching out. I do not believe the list endpoint has the ability to scope down searching by specific fields like the ones you mentioned.

You could always use the --search or -s feature flag and use spaces to include address safe platform-id and username.

See the documentation below for information about how the search query parameter works. https://docs.cyberark.com/pam-self-hosted/Latest/en/Content/SDK/GetAccounts.htm?tocpath=Developer%7CREST%20APIs%7CAccounts%7C_____1#Filter

An example would be:

cybr accounts list --search "

"

@infamousjoeg https://github.com/infamousjoeg are my assumptions correct?

— Reply to this email directly, view it on GitHub https://github.com/infamousjoeg/cybr-cli/issues/227#issuecomment-2379607569 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVGHEPS3GXDEA4K67RGCQRLZYV6INAVCNFSM6AAAAABO7JQ6KOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZZGYYDONJWHE . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AVGHEPROZGFHW4PKISHCBYDZYV6INA5CNFSM6AAAAABO7JQ6KOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUN2XXBC.gif Message ID: @. @.> >

jgkloek commented 1 week ago

Actually I’m finding it works with comma separated values. I am still trying to get the id out using jq and trying

cybr accounts list –search “safeName,address,account” | jq -r ‘.id’

All I get back is

Null

I do get the expected content without the |jq -r ‘.id’

Thanks again

Jeffrey Kloek, President

Northeast Police Precinct Ambassadors

5139 Chiswood Cove

Memphis, TN 38134

901-386-5712 Home

901-233-6817 Cell

From: Jeff Kloek @.> Sent: Friday, October 11, 2024 9:04 AM To: 'infamousjoeg/cybr-cli' @.>; 'infamousjoeg/cybr-cli' @.> Cc: 'Mention' @.> Subject: RE: [infamousjoeg/cybr-cli] Add options to get or list feature (Issue #227)

Thank you very much. I did not know we could include multiple items in the search. I should have tried it. It works fine. I appreciate it.

I got my expected output and would like to ask one more question. I understand if it is not appropriate for this thread:

I’d like to get the id field in the output using jq. I’ve tried many different iterations but am just not able to wrangle it.

I know I can do it with sed, but jq is built specifically for handling json output. Would you please consider sharing the proper syntax?

Thank you again!

Jeffrey Kloek, President

Northeast Police Precinct Ambassadors

5139 Chiswood Cove

Memphis, TN 38134

901-386-5712 Home

901-233-6817 Cell

From: Andrew Copeland @. @.> > Sent: Friday, September 27, 2024 11:00 AM To: infamousjoeg/cybr-cli @. @.> > Cc: jgkloek @. @.> >; Mention @. @.> > Subject: Re: [infamousjoeg/cybr-cli] Add options to get or list feature (Issue #227)

@jgkloek https://github.com/jgkloek Thanks for reaching out. I do not believe the list endpoint has the ability to scope down searching by specific fields like the ones you mentioned.

You could always use the --search or -s feature flag and use spaces to include address safe platform-id and username.

See the documentation below for information about how the search query parameter works. https://docs.cyberark.com/pam-self-hosted/Latest/en/Content/SDK/GetAccounts.htm?tocpath=Developer%7CREST%20APIs%7CAccounts%7C_____1#Filter

An example would be:

cybr accounts list --search "

"

@infamousjoeg https://github.com/infamousjoeg are my assumptions correct?

— Reply to this email directly, view it on GitHub https://github.com/infamousjoeg/cybr-cli/issues/227#issuecomment-2379607569 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVGHEPS3GXDEA4K67RGCQRLZYV6INAVCNFSM6AAAAABO7JQ6KOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZZGYYDONJWHE . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AVGHEPROZGFHW4PKISHCBYDZYV6INA5CNFSM6AAAAABO7JQ6KOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUN2XXBC.gif Message ID: @. @.> >

jgkloek commented 1 week ago

I finally got it:

Cybr accounts list - -search ‘username’ | jq -r .value[] | .id’

Thanks.

Jeffrey Kloek, President

Northeast Police Precinct Ambassadors

5139 Chiswood Cove

Memphis, TN 38134

901-386-5712 Home

901-233-6817 Cell

From: Jeff Kloek @.> Sent: Friday, October 11, 2024 3:52 PM To: 'infamousjoeg/cybr-cli' @.>; 'infamousjoeg/cybr-cli' @.> Cc: 'Mention' @.> Subject: RE: [infamousjoeg/cybr-cli] Add options to get or list feature (Issue #227)

Actually I’m finding it works with comma separated values. I am still trying to get the id out using jq and trying

cybr accounts list –search “safeName,address,account” | jq -r ‘.id’

All I get back is

Null

I do get the expected content without the |jq -r ‘.id’

Thanks again

Jeffrey Kloek, President

Northeast Police Precinct Ambassadors

5139 Chiswood Cove

Memphis, TN 38134

901-386-5712 Home

901-233-6817 Cell

From: Jeff Kloek @. @.> > Sent: Friday, October 11, 2024 9:04 AM To: 'infamousjoeg/cybr-cli' @. @.> >; 'infamousjoeg/cybr-cli' @. @.> > Cc: 'Mention' @. @.> > Subject: RE: [infamousjoeg/cybr-cli] Add options to get or list feature (Issue #227)

Thank you very much. I did not know we could include multiple items in the search. I should have tried it. It works fine. I appreciate it.

I got my expected output and would like to ask one more question. I understand if it is not appropriate for this thread:

I’d like to get the id field in the output using jq. I’ve tried many different iterations but am just not able to wrangle it.

I know I can do it with sed, but jq is built specifically for handling json output. Would you please consider sharing the proper syntax?

Thank you again!

Jeffrey Kloek, President

Northeast Police Precinct Ambassadors

5139 Chiswood Cove

Memphis, TN 38134

901-386-5712 Home

901-233-6817 Cell

From: Andrew Copeland @. @.> > Sent: Friday, September 27, 2024 11:00 AM To: infamousjoeg/cybr-cli @. @.> > Cc: jgkloek @. @.> >; Mention @. @.> > Subject: Re: [infamousjoeg/cybr-cli] Add options to get or list feature (Issue #227)

@jgkloek https://github.com/jgkloek Thanks for reaching out. I do not believe the list endpoint has the ability to scope down searching by specific fields like the ones you mentioned.

You could always use the --search or -s feature flag and use spaces to include address safe platform-id and username.

See the documentation below for information about how the search query parameter works. https://docs.cyberark.com/pam-self-hosted/Latest/en/Content/SDK/GetAccounts.htm?tocpath=Developer%7CREST%20APIs%7CAccounts%7C_____1#Filter

An example would be:

cybr accounts list --search "

"

@infamousjoeg https://github.com/infamousjoeg are my assumptions correct?

— Reply to this email directly, view it on GitHub https://github.com/infamousjoeg/cybr-cli/issues/227#issuecomment-2379607569 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVGHEPS3GXDEA4K67RGCQRLZYV6INAVCNFSM6AAAAABO7JQ6KOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZZGYYDONJWHE . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AVGHEPROZGFHW4PKISHCBYDZYV6INA5CNFSM6AAAAABO7JQ6KOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUN2XXBC.gif Message ID: @. @.> >