* Test wasm32-unknown-unknown in Azure Pipelines
Also gets rid of most of GitHub Actions with only E2E tests remaining.
* Remove GitHub Actions and disable non-functioning e2e testing
* Do not check all features, targets for wasm32
* Resolve PR feedback
* Update track 1 READMEs with notice
* Regenerate mgmt, svc crates
Also fixes a couple azure_svc_storage examples that somehow didn't cause errors previously.
* Import READMEs and remove cargo-readme
Fixes style check by removing use of `cargo-readme`. Instead, we'll just import the READMEs as we recommend in our modern guidelines.
* Always return `Result<Arc<Self>>` from `new` credential constructors
Resolves#1825. Also cleans up a few clippy warnings since I was running running clippy over the entire workspace.
* Fix Cosmos test
* Update README with reasoning for `Result<Arc<Self>>`
* Remove ClientSecretCredential, EnvironmentCredential
Also moves SpecificAzureCredential to a sample. Fixes#1812.
* Use DAC constructor instead of factory function
Also fixes a few lints
* Fix doc tests
* use Response's type parameter as a marker type for the body, but don't actually deserialize
* make pipeline send generic to improve type inference and reduce need for map_body
* fix doctest
* change read_body/map_body into deserialize_body/deserialize_body_into
* fix issues after rebasing
* refmt and fix compile issue
* rename FromResponseBody to Model
* fix toml spacing
* address pr feedback
* set_ -> with_
* fix formatting again :(
* Refactors most of azure_core to typespec
Little was modified when moving types and functions. Of what little was modified, most types were either separated from unrelated topics - like streams from HTTP - or better consolidated into fewer submodules to avoid complicating the module hierarchy.
`TelemetryOptions` was temporarily removed. Because `ClientOptions` was moved to `typespec_client_core` but telemetry considered Azure-specific by most other Azure SDK languages, we need to figure out how to pass this in an unbranded way. Since it basically just sets the `User-Agent` HTTP header, perhaps we can make it more generic and optional.
* Fix resolution errors on Noop client
* Fix build breaks from dependencies
* Add unconditional checks of Azure retry headers
This restores the checks for Azure-specific headers.
* Refactor general implementation into TypeSpec crates
This is part of the unbranding work across languages. For now we have decided to brand around the "TypeSpec runtime" as some other Azure SDK languages have considered.
* Fix build
* Resolve CodeStyle check issue
* Export http_response_from_body from azure_core
* Fix lint, docs errors
* Fix ErrorKind::http_response_from_body() was deleted and this code was never built. This uses the new method
* Fix: unwrap authority_host() as we are trying to store a `Url`
* Fix: `log` was not inclueded in the package dependencies. Use tracing to be consistent with the rest of the SDK
* Add check / tests to build all features in CI to prevent dead code
* Fix warnings hidden behind features
* Formatting
---------
Co-authored-by: Alex Kinnane <17098249+akinnane@users.noreply.github.co>
* Move crates into subdirs under service dirs
The exception in this commit is `typespec`, which will likely be a root
project for RFC 3243 (packages-as-namespaces) with packages thereunder.
* Fix e2e_tests.sh
* Define `Response<T>`
This doesn't actually work because object-safe traits can't have methods with type parameters, so refactoring is needed.
* Define separate `RawResponse`, `Response<T>`
* Fix code style check
* Fix wasm32-only code
* Support hierarchical Context
Conceptually similar to Go, which was also similarly copied for C++. Instead of being hierarchical, however, which introduces complexity into `len`, `is_empty`, etc. - though we might only want those for testing by GA - this uses a `Cow` to copy the `HashMap` only when necessary.
Closes#1655
* Remove `remove`, keep `len` for tests only
* core: make HttpError use content-type header to deserialize body
* core: respect Content-Type in ErrorKind::http_response_from_body
* core: correctly de-serialize XML errors with different case-ing
* cleanup if statements
* core: only parse xml error bodies if 'xml' feature is present
* core: refactor ErrorKind::HttpResponse to make use of headers
* Update sdk/core/src/error/mod.rs
Co-authored-by: Heath Stewart <heaths@outlook.com>
* Update sdk/core/src/error/http_error.rs
Co-authored-by: Heath Stewart <heaths@outlook.com>
* Update sdk/core/src/error/mod.rs
Co-authored-by: Heath Stewart <heaths@outlook.com>
* Revert "Update sdk/core/src/error/http_error.rs"
This reverts commit a2f3b4bfcf.
---------
Co-authored-by: Merlin Maggi <merlin.maggi@jls.ch>
Co-authored-by: Heath Stewart <heaths@outlook.com>
The Naive Redirect Server function accepts a u32 for what should be a 16-bit unsigned integer.
This change changes the function to accept a u16 to avoid out-of-bounds input.
In order to move towards supporting OpenTelemetry, we need to move the
underlying logging implementation to use `tracing`.
This does _not_ start exposing spans or tracing state yet.
ref: https://azure.github.io/azure-sdk/general_implementation.html
* include source stack in aggregated errors in DefaultAzureCredential
As indicated in #1543, error details are swallowed when building an
aggregate error message.
Currently, we format each of the errors using to_string, which results
in the following:
```
Error {
context: Full(
Custom {
kind: Credential,
error: Error {
context: Message {
kind: Credential,
message: "Multiple errors were encountered while attempting to authenticate:\nenvironment credential\nIMDS timeout\naz-cli",
},
},
},
"failed to get bearer token",
),
}
```
This doesn't help the user understand how to fix the issue.
With this update, we recurse through the error sources, building a more
detailed message. This results in:
```
Error {
context: Full(
Custom {
kind: Credential,
error: Error {
context: Message {
kind: Credential,
message: "Multiple errors were encountered while attempting to authenticate:\nenvironment credential - request token error - Server returned error response\nIMDS timeout - operation timed out\naz-cli - 'az account get-access-token' command failed: ERROR: AADSTS70011: The provided request must include a 'scope' input parameter. The provided value for the input parameter 'scope' is not valid. The scope https://storage.azure.com/ offline_access openid profile is not valid. The scope format is invalid. Scope must be in a valid URI form <https://example/scope> or a valid Guid <guid/scope>. Trace ID: 346f391a-48f2-4e96-849f-9ecd6c589d02 Correlation ID: 7888c325-56ff-4100-8ce2-c8cf41561b40 Timestamp: 2024-01-05 01:31:04Z\nInteractive authentication is needed. Please run:\naz login --scope https://storage.azure.com/\n",
},
},
},
"failed to get bearer token",
),
}
```
When printed, this message looks like:
```
Multiple errors were encountered while attempting to authenticate:
environment credential - request token error - Server returned error response
IMDS timeout - operation timed out
az-cli - 'az account get-access-token' command failed: ERROR: AADSTS70011: The provided request must include a 'scope' input parameter. The provided value for the input parameter 'scope' is not valid. The scope https://storage.azure.com/ offline_access openid profile is not valid. The scope format is invalid. Scope must be in a valid URI form <https://example/scope> or a valid Guid <guid/scope>. Trace ID: 02aecb08-69b4-4a5d-9ebb-784ea788c102 Correlation ID: dddc061a-ca11-4b21-b857-6d765a564597 Timestamp: 2024-01-05 01:43:45Z
Interactive authentication is needed. Please run:
az login --scope https://storage.azure.com/
```