Skip to content

Conversation

@timtay-microsoft
Copy link
Member

This incorporates the recent design choices we've agreed on with regards to ETags.

Tests will be a separate PR

Copy link
Member

@vinagesh vinagesh Jun 9, 2020

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.

Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member Author

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...

Copy link
Member

Choose a reason for hiding this comment

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

GetIfMatchHeaderValue?

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Member Author

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!

Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Member

@vinagesh vinagesh Jun 9, 2020

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

Copy link
Member

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

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

use see href here

Copy link
Contributor

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.

Copy link
Contributor

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"

Copy link
Member Author

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

Copy link
Contributor

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 ...

Copy link
Member Author

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?

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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?

Copy link
Member Author

@timtay-microsoft timtay-microsoft Jun 9, 2020

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

Copy link
Member

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.

Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@abhipsaMisra abhipsaMisra Jun 9, 2020

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

Copy link
Member

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.?

Copy link
Member Author

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

Copy link
Member

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).

@vinagesh
Copy link
Member

vinagesh commented Jun 9, 2020

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.

@timtay-microsoft
Copy link
Member Author

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

@timtay-microsoft timtay-microsoft force-pushed the feature/iot/timtay/devices branch from d39cbfa to 2739030 Compare June 9, 2020 18:32
@timtay-microsoft timtay-microsoft force-pushed the feature/iot/timtay/devices branch from 2739030 to 60abecc Compare June 9, 2020 18:34
@vinagesh
Copy link
Member

vinagesh commented Jun 9, 2020

@timtay-microsoft - In that case you might want to check on adding all other tags too. Like <returns>, <exception> etc... Only <example> would come later.

@timtay-microsoft timtay-microsoft merged commit 7a82b0d into feature/IoT-Hub Jun 9, 2020
@timtay-microsoft timtay-microsoft deleted the feature/iot/timtay/devices branch June 9, 2020 21:43
azabbasi added a commit that referenced this pull request Jun 29, 2020
* 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]>
prmathur-microsoft pushed a commit that referenced this pull request Jul 8, 2020
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants