Skip to content
This repository was archived by the owner on Oct 29, 2023. It is now read-only.

fix: add fieldMask for getDevice and listDevices - #64

Merged
gcseh merged 3 commits into
masterfrom
add-field-mask
Feb 5, 2021
Merged

fix: add fieldMask for getDevice and listDevices#64
gcseh merged 3 commits into
masterfrom
add-field-mask

Conversation

@gcseh

@gcseh gcseh commented Feb 4, 2021

Copy link
Copy Markdown
Contributor

Fixes #178

@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Feb 4, 2021
@product-auto-label product-auto-label Bot added the api: cloudiot Issues related to the googleapis/python-iot API. label Feb 4, 2021
@gcseh gcseh added the samples Issues that are directly related to samples. label Feb 4, 2021
@gcseh gcseh changed the title Add fieldMask for getDevice and listDevices fix: add fieldMask for getDevice and listDevices Feb 4, 2021

@telpirion telpirion left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Two small comments, but please do consider addressing them.

We typically use black to format our code.

Comment thread samples/api-client/manager/manager.py Outdated
device = client.get_device(request={"name": device_path})
# See full list of device fields: https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries.devices
# Warning! Use snake_case field names.
fieldMask = gp_field_mask.FieldMask(paths=['id', 'name', 'num_id', 'credentials', 'last_heartbeat_time', 'last_event_time', 'last_state_time', 'last_config_ack_time', 'last_config_send_time', 'blocked', 'last_error_time', 'last_error_status', 'config', 'state', 'log_level', 'metadata', 'gateway_config'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I suggest breaking this up into separate lines to avoid linter issues.

Comment thread samples/api-client/manager/manager.py Outdated
devices = list(client.list_devices(request={"parent": registry_path}))
# See full list of device fields: https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries.devices
# Warning! Use snake_case field names.
fieldMask = gp_field_mask.FieldMask(paths=['id', 'name', 'num_id', 'credentials', 'last_heartbeat_time', 'last_event_time', 'last_state_time', 'last_config_ack_time', 'last_config_send_time', 'blocked', 'last_error_time', 'last_error_status', 'config', 'state', 'log_level', 'metadata', 'gateway_config'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same as above. It also improves readability (and by extension, maintainability).

@gcseh
gcseh marked this pull request as ready for review February 5, 2021 12:08
@gcseh
gcseh requested a review from a team February 5, 2021 12:08
@gcseh
gcseh requested a review from a team as a code owner February 5, 2021 12:08
@gcseh
gcseh requested a review from busunkim96 February 5, 2021 12:08
@gcseh
gcseh merged commit 24c9c9a into master Feb 5, 2021
@gcseh
gcseh deleted the add-field-mask branch February 5, 2021 12:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: cloudiot Issues related to the googleapis/python-iot API. cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve FieldMask documentation

3 participants