Skip to content

Conversation

@cartertinney
Copy link
Member

  • Added support for custom SasToken TTL via the 'sastoken_ttl' kwarg on SAS-based factory methods of the IoTHub clients
  • Added support for custom SasToken TTL via the 'sastoken_ttl' kwarg on SAS-based facotry methods of the Provisioning clients

client_class.create_from_x509_certificate(
x509=x509, hostname=self.hostname, device_id=self.device_id, sastoken_ttl=1000
)

Copy link
Member Author

Choose a reason for hiding this comment

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

There is a better pattern for handling excluded kwargs from a subset of factory methods, but I'll wait to implement it until we have more than one instance of this problem

sastoken_mock = mocker.patch.object(st, "SasToken")
expected_uri = "{hostname}/devices/{device_id}".format(
hostname=self.hostname, device_id=self.device_id
)
Copy link
Member Author

@cartertinney cartertinney May 29, 2020

Choose a reason for hiding this comment

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

We test SasToken config here, as opposed in the shared user option tests, because this isn't a kwarg that goes to the PipelineConfig. I'll probably rename SharedIoTHubClientCreateMethodUserOptionTests down the road to reflect that, but I want to see how this pattern develops as we add more kwargs

@cartertinney
Copy link
Member Author

./azp run Azure.azure-iot-sdk-python-dps-e2e

@cartertinney
Copy link
Member Author

/azp run Azure.azure-iot-sdk-python-dps-e2e

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

:param proxy_options: Options for sending traffic through proxy servers.
:type proxy_options: :class:`azure.iot.device.ProxyOptions`
:param int sastoken_ttl: The time to live (in seconds) for the created SasToken used for
authentication. Default is 3600 seconds (1 hour)
Copy link
Member

Choose a reason for hiding this comment

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

random comment: I like to see the level of detail in our docstrings go up. If you haven't looked at the public-facing docstrings in the other Azure SDKs, you should (I think I'm thinking of eventhub, but maybe uamqp).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I agree, we could do a bit more. Once we get docgen occurring correctly, there's a number of improvements I think could be made.

Copy link
Member

@BertKleewein BertKleewein left a comment

Choose a reason for hiding this comment

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

:shipit:

@cartertinney cartertinney merged commit 064b9a4 into Azure:master May 29, 2020
@cartertinney cartertinney deleted the ct-add-ttl-kwarg branch January 13, 2021 19:24
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.

2 participants