-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Add implementation for Devices APIs #12611
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
Conversation
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.
Create or update a device identity? Same comment for all APIs.
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.
For this, can you check with SDK team about guidance on the type for input - ISet or IEnumerable or something else? I believe we only want to allow unique identities.
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.
The annoying thing here is that a user can create two device identities with the same device id, and the set wouldn't catch that
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.
But even still, that is a good question
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.
Same comment for everything that has IEnumerable deviceIdentities as a parameter.
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.
Leave it as it as but when you send an email about the IDictionary, just ask about this as well. That way we can represent our design choices well to the service team.
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.
nit: The name feels a little inconsistent with the API that updates a single. However, twinPatches is also not great. We can probably call it - twin and twins?
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.
Good catch. Maybe UpdateTwin(TwinData twinUpdate... and UpdateTwinsAsync(IEnumerable<TwinData> twinUpdates...
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.
GetIfMatchHeaderValue?
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.
if we use "identity" suffix in the summary, I think the parameter description also has to include the "identity" keyword
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.
same here and through out this class
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.
I think we should just be returning Tasks here, we don't need the "async" "await" pattern in the client. same goes for every other API in the document
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.
I don't think you need to call ToList() here
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.
Looks like you are right!
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.
nit: break this line into multiple lines, same for the rest off them.
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.
This is admittedly an ugly line of code, but where would you insert newlines?
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.
We usually follow this pattern:
string.Equals(
ExportImportDeviceStatus.Disabled.ToString(),
x.Status?.ToString(),
StringComparison.OrdinalIgnoreCase) ? ExportImportDeviceStatus.Disabled : ExportImportDeviceStatus.Enabled
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.
tab for each parameter when there are many
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.
Status = string.Equals(ExportImportDeviceStatus.Disabled.ToString(), x.Status?.ToString(), StringComparison.OrdinalIgnoreCase)
? ExportImportDeviceStatus.Disabled
: ExportImportDeviceStatus.Enabled
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.
use see href here
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.
same for the rest of them.
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.
I don't know what the wording for justification should be here, but probably not "pending"
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.
I'll just get rid of this for now. This suppression is something we can come back to later
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.
just device twin ? not sure ...
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.
I don't follow. This is the get call for a device's twin. What else is it getting?
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.
we have "Device Twin" in multiple places, the 's looks strange to me. it may just be me, you can ignore this :D
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.
nit: just The new representation of the device twin
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.
Should we change this type to be BulkRegistryOperationResponse? or even better, should we just remove the term Registry here? since it doesn't make sense anymore now that we have encapsulated the registry manager terminologies?
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.
For Result vs Response, sure I like Response, too. That work belongs to the swagger edit effort, though. This is a generated type
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.
I like removing the 'Registry' but maybe just post on the teams channel if everyone is onboard or has any concerns.
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.
you would just change the type name in the custom code right?
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.
I could change it in the custom code, sure
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.
I'll add it to the modified swagger file as well, so we can hopefully not have custom code for this in the future
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.
What is the behavior if DeviceIdentity.Etag = null and precondition = IfMatchPrecondition.IfMatch?
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.
Then a null ETag will be given to the PL, and the PL has logic to not send an If-Match header if the ETag is null. Effectively it is the same as just doing precondition = unconditional
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.
👍
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.
nit: The description for precondition should be similar to what we have in other methods
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.
Q - the matches in the description refers to the Etag match, correct? Why not say:
Perform this operation regardless of if the provided entity's ETag matches the service's ETag.?
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.
Sure, but with resource instead of entity for consistency
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.
Should we also specify what happens on "delete" with "*" (when the resource doesn't exist).
|
I have a general question - This is our apidesign.md. Should we do all the documentation right here and then copy during implementation or other way round? I know there is a lot of stuff we eventually added in ADT but we can all discuss and agree on the approach. |
In theory, the API design doc wasn't supposed to change after we all signed off. But in practice we keep coming up with small tweaks. I'd like to stop porting these changes to the API doc, but we can't delete that doc yet since some APIs are still under construction. So for now I just try to keep the doc consistent with the implementation |
d39cbfa to
2739030
Compare
2739030 to
60abecc
Compare
|
@timtay-microsoft - In that case you might want to check on adding all other tags too. Like |
* feat(hub): Creating a new feature branch with swagger and generated files * fix(doc): Fix markdown for API design doc (#11690) * swagger(iothub): Adding overrides for type names (#12026) * fix(tests): Fix project reference for the test framework (#12053) * fix(hub): Fix property accessibility issue (#12055) * Fix API categories for iothub service client (#12087) * swagger(iothub): Swagger comment changes (#12149) * fix(iot): Regenerate iothub PL after rebase from master * refactor(iot): Remove unnecessary custom code This class only existed to make the DigitalTwinClient internal, but now all generated clients are internal by default * Swagger changes for Iot Hub (#12218) * Revert swagger back to what is currently deployed This swagger should never be hand edited. We can update it only when service accepts the changes * Add composite swagger file with all suggested changes for service to make read only, required params, and comment refactors. OperationId changes will go in here, too * Regenerate PL with the currently deployed swagger * Update models to rename CloudToDeviceMethod and CloudToDeviceMethodResult (#12240) * Modules API design (#12188) * Add IoTHub Devices subclient APIs * Swagger changes for Client grouping (#12245) * Add suggested type name changes to iothub swagger (#12296) * Service Client CL and client grouping (#12323) * Small API design comments fix * feat(autorest): Generated clients from autorest after sync with master * Add implementation for Devices APIs (#12611) * (feat): Implement Modules client (#12673) * feat(tests): Add test infrastructure and setup.ps1 for local setup (#12719) * Add test infrastructure and setup * Add common files, remove specific sub (#12722) * fix(swagger): Fix IotHub swagger descriptions (#12695) * fix(pipeline): Update setup script to call test-resources ARM template directly (#12775) * feat(samples): Samples project skeleton (#12787) * IoT hub service client authentication via connection string (#12731) * feat(e2e-tests): Add initial setup for E2E tests * feat(iot-service): Add authentication via connection string * fix(iot-service): Fix merge conflict in infrastructure setup file (#12803) Co-authored-by: Abhipsa Misra <[email protected]> * feat(tests): Changes to fix tests and make sure we can run them successfully. (#12819) * Start recording tests and add intial Session recording (#12827) * feat(samples): Initial CREATE/DELETE sample for ModuleI (#12850) * feat(samples): Finish Modules samples (#12989) * feat(e2e): Devices E2E tests (#12997) * Update the logic for ETags and preconditions (#13046) * Fix the CI and test pipelines. (#13091) Co-authored-by: abhipds <[email protected]> Co-authored-by: Abhipsa Misra <[email protected]> Co-authored-by: vinagesh <[email protected]> Co-authored-by: timtay-microsoft <[email protected]> Co-authored-by: bikamani <[email protected]> Co-authored-by: Sindhu Nagesh <[email protected]> Co-authored-by: Abhipsa Misra <[email protected]>
* feat(hub): Creating a new feature branch with swagger and generated files * fix(doc): Fix markdown for API design doc (#11690) * swagger(iothub): Adding overrides for type names (#12026) * fix(tests): Fix project reference for the test framework (#12053) * fix(hub): Fix property accessibility issue (#12055) * Fix API categories for iothub service client (#12087) * swagger(iothub): Swagger comment changes (#12149) * fix(iot): Regenerate iothub PL after rebase from master * refactor(iot): Remove unnecessary custom code This class only existed to make the DigitalTwinClient internal, but now all generated clients are internal by default * Swagger changes for Iot Hub (#12218) * Revert swagger back to what is currently deployed This swagger should never be hand edited. We can update it only when service accepts the changes * Add composite swagger file with all suggested changes for service to make read only, required params, and comment refactors. OperationId changes will go in here, too * Regenerate PL with the currently deployed swagger * Update models to rename CloudToDeviceMethod and CloudToDeviceMethodResult (#12240) * Modules API design (#12188) * Add IoTHub Devices subclient APIs * Swagger changes for Client grouping (#12245) * Add suggested type name changes to iothub swagger (#12296) * Service Client CL and client grouping (#12323) * Small API design comments fix * feat(autorest): Generated clients from autorest after sync with master * Add implementation for Devices APIs (#12611) * (feat): Implement Modules client (#12673) * feat(tests): Add test infrastructure and setup.ps1 for local setup (#12719) * Add test infrastructure and setup * Add common files, remove specific sub (#12722) * fix(swagger): Fix IotHub swagger descriptions (#12695) * fix(pipeline): Update setup script to call test-resources ARM template directly (#12775) * feat(samples): Samples project skeleton (#12787) * IoT hub service client authentication via connection string (#12731) * feat(e2e-tests): Add initial setup for E2E tests * feat(iot-service): Add authentication via connection string * fix(iot-service): Fix merge conflict in infrastructure setup file (#12803) Co-authored-by: Abhipsa Misra <[email protected]> * feat(tests): Changes to fix tests and make sure we can run them successfully. (#12819) * Start recording tests and add intial Session recording (#12827) * feat(samples): Initial CREATE/DELETE sample for ModuleI (#12850) * feat(samples): Finish Modules samples (#12989) * feat(e2e): Devices E2E tests (#12997) * Update the logic for ETags and preconditions (#13046) * Fix the CI and test pipelines. (#13091) Co-authored-by: abhipds <[email protected]> Co-authored-by: Abhipsa Misra <[email protected]> Co-authored-by: vinagesh <[email protected]> Co-authored-by: timtay-microsoft <[email protected]> Co-authored-by: bikamani <[email protected]> Co-authored-by: Sindhu Nagesh <[email protected]> Co-authored-by: Abhipsa Misra <[email protected]>
This incorporates the recent design choices we've agreed on with regards to ETags.
Tests will be a separate PR