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

CBAPI-3712: guide for Device Actions #494

Merged
merged 6 commits into from
Mar 20, 2024

Conversation

abowersox-cb
Copy link
Contributor

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Tests have been added that prove the fix is effective or that the feature works.
  • New and existing tests pass locally with the changes.
  • Code follows the style guidelines of this project (PEP8, clean code, linter).
  • A self-review of the code has been done.

What is the ticket or issue number?

Pull Request Description

Does this introduce a breaking change?

  • Yes
  • No

How Has This Been Tested?

Copy link
Collaborator

@avanbrunt-cb avanbrunt-cb left a comment

Choose a reason for hiding this comment

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

Overall a great guide. A few small changes and it looks good to me

docs/devices.rst Outdated
Comment on lines 56 to 62
# assume "api" is your CBCloudAPI reference
query = api.select(Device)
# add search terms and/or criteria to the query (not shown here)
for d in query:
do_something_with_device(d) # whatever you need for each device
while query.num_remaining > 0:
query.scroll() # default is 10,000 devices at a time
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not correct you can't iterate the query then call scroll. You need to call scroll from the beginning as that also fetches the first 10k devices.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm changing this example, so I hope I get it right.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The scroll function does not act like an internal save within the query object instead it returns the results. See the docs https://carbon-black-cloud-python-sdk.readthedocs.io/en/latest/cbc_sdk.platform/#cbc_sdk.platform.devices.DeviceSearchQuery.scroll

docs/devices.rst Outdated Show resolved Hide resolved
docs/devices.rst Outdated Show resolved Hide resolved
docs/devices.rst Outdated Show resolved Hide resolved
Copy link
Collaborator

@avanbrunt-cb avanbrunt-cb left a comment

Choose a reason for hiding this comment

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

Please make changes to the guide whether or not you pull content from the user guide

@abowersox-cb
Copy link
Contributor Author

Please make changes to the guide whether or not you pull content from the user guide

Already done in the last change. Just explaining why things were the way they were.

docs/devices.rst Outdated Show resolved Hide resolved
docs/devices.rst Outdated Show resolved Hide resolved
@abowersox-cb abowersox-cb changed the title CBABI-3712: guide for Device Actions CBAPI-3712: guide for Device Actions Mar 18, 2024
@abowersox-cb abowersox-cb marked this pull request as ready for review March 19, 2024 18:22
@abowersox-cb abowersox-cb merged commit 92d0e36 into develop Mar 20, 2024
4 checks passed
@abowersox-cb abowersox-cb deleted the CBAPI-3712_device_actions_guide branch March 20, 2024 13:59
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.

None yet

3 participants