Skip to content

Conversation

@evlin-rh
Copy link
Contributor

Added additional filters as flags to the osdctl cloudtrail write-events command:

  1. Username
  2. Arn
  3. Resource
  4. Event

The filters are lists and can be specified as inclusive or exclusive.
Add days and weeks to the --since flag.
Add inclusive and exclusive filters.

@openshift-ci-robot
Copy link

openshift-ci-robot commented May 29, 2025

@evlin-rh: An error was encountered searching for bug SREP-217 on the Jira server at https://issues.redhat.com/. No known errors were detected, please see the full error message for details.

Full error message. You do not have the permission to see the specified issue.: request failed. Please analyze the request body for more details. Status code: 401:

Please contact an administrator to resolve this issue, then request a bug refresh with /jira refresh.

Details

In response to this:

Added additional filters as flags to the osdctl cloudtrail write-events command:

  1. Username
  2. Arn
  3. Resource
  4. Event

The filters are lists and can be specified as inclusive or exclusive.
Add days and weeks to the --since flag.
Add inclusive and exclusive filters.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@evlin-rh evlin-rh marked this pull request as draft May 29, 2025 10:20
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 29, 2025
@openshift-ci openshift-ci bot requested review from fahlmant and sam-nguyen7 May 29, 2025 10:22
@evlin-rh evlin-rh force-pushed the osdctl-filter branch 4 times, most recently from 2308a64 to ac03f7a Compare June 10, 2025 13:02
@evlin-rh evlin-rh force-pushed the osdctl-filter branch 2 times, most recently from 5501638 to b69e6a5 Compare June 11, 2025 10:54
@zmird-r
Copy link
Contributor

zmird-r commented Jun 19, 2025

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jun 19, 2025

func newCmdPermissionDenied() *cobra.Command {
opts := &permissionDeniedEventsOptions{}
opts := &permissionDeniedEventsOptions{} //Stores address of struct into opts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems redundant

@zmird-r
Copy link
Contributor

zmird-r commented Jun 19, 2025

Here's a possible improvement to the CLI flags, which greatly reduces the number of flags needed:

$ osdctl cloudtrail write-events --include username=example1 --include username=example2 --exclude  resourcetype=example3                                                                                                                                                             

This way, you start with two lists, include and exclude, it's straightforward to tell whether the lists have any value in common (which we don't want), and parsing is fairly easy by splitting on the = symbol

@evlin-rh evlin-rh force-pushed the osdctl-filter branch 2 times, most recently from 4f5e244 to a5e8820 Compare June 23, 2025 08:31
@evlin-rh evlin-rh force-pushed the osdctl-filter branch 5 times, most recently from baf01cb to f1e9230 Compare July 22, 2025 15:06
@zmird-r
Copy link
Contributor

zmird-r commented Jul 30, 2025

/lgtm

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 30, 2025
@evlin-rh evlin-rh marked this pull request as ready for review July 31, 2025 12:55
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 31, 2025
@openshift-ci openshift-ci bot requested review from bergmannf and iamkirkbater July 31, 2025 12:56
@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 278860c and 2 for PR HEAD f1e9230 in total

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD da1f99b and 1 for PR HEAD f1e9230 in total

@evlin-rh
Copy link
Contributor Author

evlin-rh commented Aug 1, 2025

/retest

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 1, 2025
@evlin-rh
Copy link
Contributor Author

evlin-rh commented Aug 1, 2025

/retest

FIX: permission_denied.go now uses GetEvents()

CLEANUP: Comment and Code Cleanup

ADD: Filters for write-event.go

REFACTOR: Filters.go

CLEANUP: Code Cleanup, Variable Renaming

ADD: Sample code in flags

REFACTOR & FIX: Code cleanup in cloudtrail & filter.go refactored

NEW CODE: Remodel filter function to use lambda for readability

REFACTOR: Refactored Files To Provide Linear Imports

FIX: Issues with go.mod

FEAT: Added ValidateFilters before any time requiring operation are required

REFACTOR: Added filter package

REMOVE: util.go

FEAT: Added functionality to inlcude resource-name & type
      This is mainly because permission denied also requires PrintEvent

FIX: testdata go files had issues with imports

REFACTOR: removed event, aws and filter packages to reduce complexity.

FEAT: Added EndTime for --until flag

FEAT: Added --print-format to allow users to specify which fields to print

REFACTOR: Added time.go for --until --after --since flag

DONE: Final Cleanup for SREP-217 & Documentation
@evlin-rh
Copy link
Contributor Author

evlin-rh commented Aug 1, 2025

/retest

1 similar comment
@evlin-rh
Copy link
Contributor Author

evlin-rh commented Aug 5, 2025

/retest

@zmird-r
Copy link
Contributor

zmird-r commented Aug 19, 2025

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 19, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 19, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evlin-rh, zmird-r

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 19, 2025

@evlin-rh: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit c671e12 into openshift:master Aug 19, 2025
7 checks passed
nephomaniac pushed a commit to nephomaniac/osdctl that referenced this pull request Aug 20, 2025
…#760)

* SREP-217: Changed cluster-id to id-cluster

* ADD: Username Filter for OSDCTL Write Events

Still Missing ErrorChecking and Showing errors if no matching username

* UPDATE: Added Print Username Not recognized if nothing found

* ADD: Events Filter

* ADD: Resource Name and Type to PrintEvents

* ADD: Resource Type Filters

* Update: Resource Type and Name

Both Working

* REFACTOR: Refactored AWS.go Write-events.go

Refactored aws.go to use Case-Switching to prevent duplications of Code

Used Slices for Filters

* REFACTOR: Created Filter Function

Moved Filtering into its own separate function

* ADD: Exclusion Filters

More said in documentation

* ADD: Filter by list and Print out Errors

* ADD: Filters with ARN

* Test

* ADD: Day and Weeks to --since flag

FIX: permission_denied.go now uses GetEvents()

CLEANUP: Comment and Code Cleanup

ADD: Filters for write-event.go

REFACTOR: Filters.go

CLEANUP: Code Cleanup, Variable Renaming

ADD: Sample code in flags

REFACTOR & FIX: Code cleanup in cloudtrail & filter.go refactored

NEW CODE: Remodel filter function to use lambda for readability

REFACTOR: Refactored Files To Provide Linear Imports

FIX: Issues with go.mod

FEAT: Added ValidateFilters before any time requiring operation are required

REFACTOR: Added filter package

REMOVE: util.go

FEAT: Added functionality to inlcude resource-name & type
      This is mainly because permission denied also requires PrintEvent

FIX: testdata go files had issues with imports

REFACTOR: removed event, aws and filter packages to reduce complexity.

FEAT: Added EndTime for --until flag

FEAT: Added --print-format to allow users to specify which fields to print

REFACTOR: Added time.go for --until --after --since flag

DONE: Final Cleanup for SREP-217 & Documentation

---------

Co-authored-by: openshift-merge-bot[bot] <148852131+openshift-merge-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants