-
Notifications
You must be signed in to change notification settings - Fork 121
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
update: default no longer returning RETIRED devices from get_devices #796
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -622,10 +622,12 @@ def search_devices( | |
all the filters `arns`, `names`, `types`, `statuses`, `provider_names`. | ||
|
||
Args: | ||
arns (Optional[list[str]]): device ARN list, default is `None`. | ||
names (Optional[list[str]]): device name list, default is `None`. | ||
types (Optional[list[str]]): device type list, default is `None`. | ||
statuses (Optional[list[str]]): device status list, default is `None`. | ||
arns (Optional[list[str]]): device ARN filter, default is `None`. | ||
names (Optional[list[str]]): device name filter, default is `None`. | ||
types (Optional[list[str]]): device type filter, default is `None`. | ||
statuses (Optional[list[str]]): device status filter, default is `None`. When `None` | ||
is used, RETIRED devices will not be returned. To include RETIRED devices in | ||
the results, use a filter that includes `RETIRED` for this parameter. | ||
provider_names (Optional[list[str]]): provider name list, default is `None`. | ||
|
||
Returns: | ||
|
@@ -645,6 +647,8 @@ def search_devices( | |
continue | ||
if statuses and result["deviceStatus"] not in statuses: | ||
continue | ||
if statuses is None and result["deviceStatus"] == "RETIRED": | ||
continue | ||
Comment on lines
+650
to
+651
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Am I missing something, or does this not actually impact the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does fix our time issue. Even though the API returns all values, we will filter our the retired ones. This means that when we actually do get_device for all returned devices, we will be doing many fewer calls. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah that's the piece I was missing, that makes sense if |
||
if provider_names and result["providerName"] not in provider_names: | ||
continue | ||
results.append(result) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smallest nit: in this context we mean the string
"RETIRED"
, unless we have an enum somewhere definingRETIRED