Commit Graph

359 Commits

Author SHA1 Message Date
Victor Vazquez
cb39ec302c
Update RetryPolicy logic to use only one context (#2047)
* progress

* missing

* fix comp errors

* remove comments

* Bad merge with my recent changes to master

* Format

Co-authored-by: Ahson Khan <ahson_ahmedk@yahoo.com>
Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com>
2021-04-05 19:50:17 -07:00
Anton Kolesnyk
3b36c9091a
Add policy tests (#2009)
Closes #271
Closes #1570
Closes #1596
2021-04-06 02:10:30 +00:00
Ahson Khan
93bc8c4218
Make the Context parameter optional in BodyStream public Read methods. (#2046)
* Make the Context parameter optional in BodyStream public Read methods.

* Add some basic unit tests.

* Fix end of line.
2021-04-06 01:40:14 +00:00
Ahson Khan
d638d1ff3d
Move package version to details, and rename VersionString() to ToString(). (#2042) 2021-04-06 00:50:25 +00:00
Ahson Khan
63b2d21bc6
Renamed Azure::Nullable<T>::GetValue() to Value(). (#2034)
* Renamed `Azure::Nullable<T>::GetValue()` to `Value()`.

* Update clang formatting.
2021-04-05 15:42:14 -07:00
Anton Kolesnyk
c5ddbbc430
Changes around context expiration naming and types (#2033)
This would unblock #2010.

Closes #2032.
Closes #1880.

I know this comes out of the blue, but it seems to me the right change to do. This is a proposal, let me know what you think.

First, I started with the fact that we need to make `CancelWhen()` public.
Then, I realized that I don't like the `CancelWhen()` naming. `CancelAt()` is better?
But `CancelAt()` sounds like an order to do something, not as getter.
So, it should be named `Get...`. `GetCancelWhen()`? `GetCancelAt()`? Sounds strage.

`GetDeadline()` - not bad, bit it is not that clear, what the deadline is.
And I looked at the `WithDeadline()` method. And in comment, the first line is `@brief Create a context with expiration.`.
"Expiration" sounds better explanation for the essense of the "deadline".

So, I went with `GetExpiration()`. I think "Expiration" is also a better name, because should we want to add the method called "bool IsExpired()", it comes naturally using the existing terminology, sounds better than "`IsPastDeadline()`".

Next thing - if we have "`GetExpiration()`", it is strange to have a method called `Get()`. So, we have `WithExpiration()` and `WithValue()`. So, it sounds like the getter should be called `GetValue()`. I did that rename as well.

Then, I looked at "`With...`" method naming. It is a factory method. If for getters we have `Get`, then for factory methods we should have `Create`. So, I renamed `WithExpiration()` and `WithValue()` to `CreateWithExpiration()` and `CreateWithValue()`.

Then I looked at `Context::time_point` typedef. First, in general, if we can avoid public typedefs, it is better, because we don't need to document them and worry if we broke client code when we change them.
Second, it is strange that we use `Azure::DateTime` everywhere, but not in context.

So, I replaced it with `Azure::DateTime`. It is good because it allows us to drop to/from epoch conversions (#1880), and really all that extra dance we do to cast to representation and back to datetime is the ways to stay within legal type casting limits of compiler type declaration, while in reality there isn't much that is happening in the code: `DateTime` is essentially an `int64`, and with all these conversions to epoch time, then to representation and back, compiler does not generate real code, it still operates with that only `int64`.

Why we cast to `DateTime::rep` and back at all? Context stores it as `atomic`, and I am not questioning that. You can't get `std::atomic<DateTime>` today explicitly, so we "extract" representation (`int64`) and store it as `std::atomic<DateTime::rep>`, which is the same thing as `std::atomic_int64`.

-- Update: --
1. "Expiration" => "Deadline" (Jeffrey's request)
2. Added `Context::HasExpiration()` (response to Jinming) // plus, we do have `HasValue()` so why not have `HasDeadline()`.
3. `WithDeadline()`, `WithValue` => Two overloads of `CreateChildContext()` (my own initiative).

-- Update 2: --
`CreateChildContext()` => `WithDeadline()`, `WithValue`

-- Update 3: --
Removed `HasDeadline()`
2021-04-05 21:24:40 +00:00
Victor Vazquez
dfdaf25223
[Core] Refactor RequestFailedException with Http information (#2026)
* KeyVault Exception
2021-04-05 12:11:31 -07:00
Anton Kolesnyk
a7fdea42e6
Introduce Context::Key with pointer comparison speeds (#1988) 2021-04-05 11:26:50 -07:00
Ahson Khan
8095d85e67
Simplify the public surface design of Response<T> for usability. (#1974)
* Simplify the design of Response<T> for usability.

* Revert changes to operation<T> to keep the changes single purpose.

* Update many of the response<T> call sites based on API changes.

* Update all remaining callsites and fix clang formatting.

* Update Response<T> documentation.

* Fix clang formatting.

* Remove status code from the Response<T> public surface area.

* Update the changelog.

* Fix up CL wording and remove commented-out change to operation<T>.

* Fixed test by actually calling a method.

* Fix up key vault test by not taking ownership of raw response.

* Fix call to get status code in test.

* Add new line at end of keyvualt live test file.

* Make a local copy within keyvault pipeline to avoid compilers re-ordering things.

* Make the fixes to the recent keyvault changes.

* Fix key vault pipeline to address ImportKey test failure
2021-04-01 00:50:04 +00:00
Victor Vazquez
41be347002
remove-http-response-apis (#1998)
* remove-http-response-apis
2021-03-31 23:53:38 +00:00
Victor Vazquez
bae16450c9
update 3rd party httpbin server for inhouse instance (#1935)
* update 3rd party httpbin server for inhouse instance
2021-03-31 16:35:03 -07:00
Anton Kolesnyk
ddd7a093f4
Move policies to internal (#1985) 2021-03-31 12:56:33 -07:00
Victor Vazquez
a4ae81708b
[Keyvault] APIs (#1967)
Adding the next APIs:

UpdateKeyProperties, fixes: #1541
GetPropertiesOfKeys , fixes: #1542
GetPropertiesOfKeyVersions, fixes: #1543
GetDeletedKeys, fixes: #1546
PurgeDeletedKey, fixes: #1547
StartRecoveryDeletedKey, fixes: #1548
BackupKey, fixes: #1549
RestoreKeyBackup, fixes: #1550
ImportKey, fixes: #1551
Add samples, fixes: #1987
2021-03-30 20:12:48 +00:00
Victor Vazquez
7490709db4
test for Context heap integrity (#1999) 2021-03-30 18:52:47 +00:00
Anton Kolesnyk
0665efe0fe
unique_ptr Get() => Extract() || Send() || ExtractOrCreate() (#1984) 2021-03-30 10:17:24 -07:00
Anton Kolesnyk
b606ff60dc
Add ADFS support for ClientSecretCredential (#1947) 2021-03-29 17:26:42 -07:00
Victor Vazquez
d6cd0af3cc
remove value policy from core (#1917) 2021-03-23 22:31:54 +00:00
Ahson Khan
9f4b389f4d
Update relative links to sections in the contributing guide doc to fix link verification (#1955)
* Update relative links to sections in the contributing guide doc to fix link verification

* Make some source code change modifications to trigger GenerateRelease CI steps

* Don't use relative paths in links, instead use the full path from master to be consistent with other places
2021-03-22 21:41:46 +00:00
Victor Vazquez
1321855517
Operation t docs (#1902)
* operation tech doc
2021-03-19 22:06:08 -07:00
Victor Vazquez
a5bc8fe0ef
Adding GetDeletedKey (#1907)
* Adding GetDeletedKey
2021-03-17 18:15:35 +00:00
Victor Vazquez
009260c50a
rename private method (#1903) 2021-03-16 00:51:14 +00:00
Ahson Khan
c9e02370fe
Add back-ticks around Response<void> in changelog (#1886)
* Add back-ticks around `Response<void>` in changelog

* Remove extra whitespace after type name in identity CL.

* Add back-ticks around type name in identity CL.

Co-authored-by: Victor Vazquez <victor.vazquez@microsoft.com>
2021-03-13 05:29:50 +00:00
Azure SDK Bot
e1288767d4
Increment package version after release of azure-core (#1887)
Co-authored-by: Rick Winter <rick.winter@microsoft.com>
2021-03-12 09:49:27 -08:00
Ahson Khan
a864982208
Add date to the changelog for packages shipping today. (#1884) 2021-03-11 20:45:31 -08:00
Anton Kolesnyk
299b07e190
Changelog: Rephrase to move related entities closer together. (#1874)
* Move changelog entry to correct place

* Reformat breaking changes

* New feature in the right place

* body_stream.hpp

* Backtick

* Add changes made for Context

* More updates

* More updates

Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-03-11 19:47:17 -08:00
Victor Vazquez
825d4f11d5
make poll return const ref to rawResponse (#1875)
* make poll return const ref to rawResponse
2021-03-12 03:18:47 +00:00
Ahson Khan
fc79c5b3ad
Rename header files to match the namespace structure for things nested within Azure::Core. (#1879)
* Rename header files to match the namespace structure for things nested
within Azure::Core.

* Update a header include that was missed.
2021-03-11 16:22:37 -08:00
Ahson Khan
bd8336f8a2
Removed Azure::Core::Http::InvalidHeaderException and throw std::invalid_argument if the user provides invalid header arguments. (#1871) 2021-03-11 13:42:33 -08:00
Ahson Khan
6a1afb9cbe
Moved the Base64Encode() and Base64Decode() functions to be static members of a Convert class within the Azure::Core namespace. (#1870)
* Moved the `Base64Encode()` and `Base64Decode()` functions to be static members of a `Convert` class within the `Azure::Core` namespace.

* Add the class name in the source file for posix.
2021-03-11 12:39:51 -08:00
Rick Winter
7c862e1a51
Switch to return the RawResponse const& (#1852)
* Operation returns a RawResposne const&
2021-03-11 10:59:33 -08:00
Anton Kolesnyk
64c0af3f67
Fix build on VS2017 (#1864) 2021-03-11 18:43:27 +00:00
Ahson Khan
ec1c92f2ea
Fix to call the instance method on bodystream from recent tests. (#1866) 2021-03-11 17:57:06 +00:00
Ahson Khan
12475350b2
Changed the static methods 'BodyStream::ReadToCount()' and 'BodyStream::ReadToEnd()' into instance methods. (#1863)
Usability studies found that static methods are generally not as user-friendly as instance methods. Folks new to the SDK have harder time discovering the APIs, they reverse the flow of typing, and the calling code ends up a bit more verbose because you have to spell out the whole namespace and type name when there aren't any using directives.

There doesn't seem to be a strong benefit or feasibility reason to keep these method statics which are typically harder to use and discover.

cc @kyle-patterson
2021-03-11 11:58:33 +00:00
Ahson Khan
84df3cefbc
Make FileBodyStream easy to construct by accepting a file name, and create an internal ParallelFileBodyStream. (#1830)
Alternative to https://github.com/Azure/azure-sdk-for-cpp/pull/1730 which avoids accepting and breaking the `FILE*` abstraction.
2021-03-11 08:39:52 +00:00
Victor Vazquez
c0ce9688d6
fix regression on contex value implementation for Storage (#1862) 2021-03-11 07:53:33 +00:00
Victor Vazquez
23b698f2c6
Move URL to CORE (#1840)
* move url from Core::Http to Core::
2021-03-10 23:29:35 -08:00
Victor Vazquez
a9c0637e46
Moving Nullable<T> to Azure namespace (#1847)
* Moving Nullable<T> to Azure namespace

* changelog
2021-03-10 18:56:11 -08:00
Victor Vazquez
c7ba56f837
Move http policies to Azure::Core::Http::Policies (#1844)
* Move http policies to Azure::Core::Http::Policies

* update to latest master
2021-03-10 18:55:56 -08:00
Victor Vazquez
33c95b09e9
make curl transport adapter to request new connection if sending fails (#1721)
* make curl transport adapter to request new connection if sending fails
2021-03-10 18:02:04 -08:00
Anton Kolesnyk
de0cb8a720
Azure::Core::Diagnostics (#1851)
Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-03-10 17:20:45 -08:00
Ahson Khan
f1773636c2
Consolidate the changelog entry for bodystream changes. (#1843) 2021-03-10 17:11:07 -08:00
Anton Kolesnyk
698fac6f19
DefaultAllowedHttpHeaders: Make static default const (#1849)
Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-03-10 16:40:34 -08:00
Anton Kolesnyk
865f707532
Azure::Core::Credentials (#1846)
Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-03-10 16:22:10 -08:00
Ahson Khan
2a1ea1f890
Rename the Range type to HttpRange within the Azure::Core::Http namespace. (#1835)
Part of https://github.com/Azure/azure-sdk-for-cpp/issues/1789

> We shouldn't have Method, StatusCode, or Range. The way to reason about this is chances of collision and ease of documentation/discover-ability in SEO. RawResponse is specific enough that it doesn't need Http prefix, that's how I would draw the line.
2021-03-10 23:26:36 +00:00
Rick Winter
ec24f659c4
Simplify the Context structure (#1824)
* Simplify the Context structure
* Move Azure::Core::GetApplicationContext() to Azure::Core::Context::GetApplicationContext()
2021-03-10 23:19:23 +00:00
Anton Kolesnyk
48258f8f81
Azure::*::_detail::Version => Azure::*::PackageVersion (#1839)
Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-03-10 15:15:28 -08:00
Anton Kolesnyk
76870c4414
Azure::Core::DateTime => Azure::DateTime (#1836)
Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-03-10 22:44:09 +00:00
Victor Vazquez
7fca169d25
Create StringExtensions in azure core internal (#1837) 2021-03-10 14:13:51 -08:00
Anton Kolesnyk
2562df6682
_internal::Json => Json::_internal (#1834)
Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-03-10 14:05:35 -08:00
Ahson Khan
3d6cd38658
Move Azure::IO types like BodyStream to Azure::Core::IO. (#1833)
Part of https://github.com/Azure/azure-sdk-for-cpp/issues/1789

From Jeff:
> BodyStream is only exposed to users when uploading/downloading bytes. Except for Storage almost no services do this at all; they read the stream and deserialize into a structure and the customer gets the structure - not the stream. Azure::Core:IO is a fine namespace.
2021-03-10 21:36:29 +00:00