Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOAR-18656] Mimecast V2 #3066

Merged
merged 7 commits into from
Jan 29, 2025
Merged

[SOAR-18656] Mimecast V2 #3066

merged 7 commits into from
Jan 29, 2025

Conversation

ablakley-r7
Copy link
Collaborator

@ablakley-r7 ablakley-r7 commented Jan 28, 2025

Proposed Changes

Description

Describe the proposed changes:

  • Initial task code
  • TODO: De-duplication, error handling, rate limit and retry logic, threading for efficiency, custom data classes, unit tests

PR Requirements

Developers, verify you have completed the following items by checking them off:

Testing

Unit Tests

Review our documentation on generating and writing plugin unit tests

  • Unit tests written for any new or updated code

In-Product Tests

If you are an InsightConnect customer or have access to an InsightConnect instance, the following in-product tests should be done:

  • Screenshot of job output with the plugin changes
  • Screenshot of the changed connection, actions, or triggers input within the InsightConnect workflow builder

Style

Review the style guide

  • For dependencies, pin OS package and Python package versions
  • For security, set least privileged account with USER nobody in the Dockerfile when possible
  • For size, use the slim SDK images when possible: rapid7/insightconnect-python-3-38-slim-plugin:{sdk-version-num} and rapid7/insightconnect-python-3-38-plugin:{sdk-version-num}
  • For error handling, use of PluginException and ConnectionTestException
  • For logging, use self.logger
  • For docs, use changelog style
  • For docs, validate markdown with insight-plugin validate which calls icon_validate to lint help.md

Functional Checklist

  • Work fully completed
  • Functional
    • Any new actions/triggers include JSON test files in the tests/ directory created with insight-plugin samples
    • Tests should all pass unless it's a negative test. Negative tests have a naming convention of tests/$action_bad.json
    • Unsuccessful tests should fail by raising an exception causing the plugin to die and an object should be returned on successful test
    • Add functioning test results to PR, sanitize any output if necessary
      • Single action/trigger insight-plugin run -T tests/example.json --debug --jq
      • All actions/triggers shortcut insight-plugin run -T all --debug --jq (use PR format at end)
    • Add functioning run results to PR, sanitize any output if necessary
      • Single action/trigger insight-plugin run -R tests/example.json --debug --jq
      • All actions/triggers shortcut insight-plugin run --debug --jq (use PR format at end)

Assessment

You must validate your work to reviewers:

  1. Run insight-plugin validate and make sure everything passes
  2. Run the assessment tool: insight-plugin run -A. For single action validation: insight-plugin run tests/{file}.json -A
  3. Copy (insight-plugin ... | pbcopy) and paste the output in a new post on this PR
  4. Add required screenshots from the In-Product Tests section

@ablakley-r7 ablakley-r7 requested a review from a team as a code owner January 28, 2025 11:55
plugins/mimecast_v2/icon_mimecast_v2/util/api.py Outdated Show resolved Hide resolved
plugins/mimecast_v2/icon_mimecast_v2/util/api.py Outdated Show resolved Hide resolved
plugins/mimecast_v2/icon_mimecast_v2/util/api.py Outdated Show resolved Hide resolved
plugins/mimecast_v2/icon_mimecast_v2/util/api.py Outdated Show resolved Hide resolved
plugins/mimecast_v2/icon_mimecast_v2/util/api.py Outdated Show resolved Hide resolved
plugins/mimecast_v2/icon_mimecast_v2/util/api.py Outdated Show resolved Hide resolved
plugins/mimecast_v2/icon_mimecast_v2/util/api.py Outdated Show resolved Hide resolved
Comment on lines +186 to +191
if isinstance(query_date, str):
query_date = datetime.strptime(query_date, "%Y-%m-%d").date()
if (not log_type_config.get("caught_up")) or query_date < now_date:
has_more_pages = True
log_type_config["query_date"] = query_date.strftime("%Y-%m-%d")
state["query_config"] = query_config
Copy link
Collaborator

Choose a reason for hiding this comment

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

it might be worth making "%Y-%m-%d" as a constant at the top as its used a few times throughout

@ablakley-r7 ablakley-r7 merged commit dcecd4e into develop Jan 29, 2025
10 of 11 checks passed
ablakley-r7 added a commit that referenced this pull request Feb 4, 2025
* Initial task code

* Format api.py

* Refactor task

* Validators

* Update state

* Add todo. Update state handling.

* Update version
rbowden-r7 pushed a commit that referenced this pull request Feb 5, 2025
* Initial task code

* Format api.py

* Refactor task

* Validators

* Update state

* Add todo. Update state handling.

* Update version
ablakley-r7 added a commit that referenced this pull request Feb 5, 2025
* Initial task code

* Format api.py

* Refactor task

* Validators

* Update state

* Add todo. Update state handling.

* Update version
ablakley-r7 added a commit that referenced this pull request Feb 5, 2025
* [SOAR-18655] Mimecast V2 (#3063)

* Initial plugin

* Initial plugin

* [SOAR-18656] Mimecast V2 (#3066)

* Initial task code

* Format api.py

* Refactor task

* Validators

* Update state

* Add todo. Update state handling.

* Update version

* [SOAR-18657] mimecast v2 (#3068)

* Update threads, error handling, custom config, rate limiting

* Add connection test

* Fix lint

* Add unit tests

* Add unit tests

* Fix requiremnts

* Fix requiremnts

* Mimecast V2 - Fix connection test | Fix custom config (#3071)

* Fix connection test | Fix custom config

* Fix type hint

* Add tooltip (#3074)
ablakley-r7 added a commit that referenced this pull request Feb 5, 2025
* Initial task code

* Format api.py

* Refactor task

* Validators

* Update state

* Add todo. Update state handling.

* Update version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants