Граф коммитов

190 Коммитов

Автор SHA1 Сообщение Дата
Heath Stewart d7137b088f
Test wasm32-unknown-unknown in Azure Pipelines (#1903)
* 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
2024-11-08 14:41:21 -08:00
Heath Stewart 1038a6fe99
Remove duplicate re-export of Model macro (#1864)
Also re-exports `Model` from `azure_core` along with some other types that were exported from the crate root in track 1.
2024-10-22 16:50:52 -07:00
Heath Stewart 1899267335
Merge branch 'feature/track2'
Active development on crates will continue in the main branch.
2024-10-18 16:39:29 -07:00
Heath Stewart 25ebe5a599
Update track 1 READMEs with notice (#1841)
* 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.
2024-10-09 15:47:54 -07:00
Heath Stewart faa662ce5a
Regenerate track 1 crates (#1835)
* Update codegen branch URL, versions

* Update authored branch URLs, versions

* Bump crate versions and ignore problematic api-version

* Regenerate mgmt, svc crates

* Fix azure_core crate ref in storage

* Fix more clippy lints

* More codegen and clippy fixes

* Run generator with previous fixes
2024-10-08 16:32:12 -07:00
Ashley Stanton-Nurse 42c5ce8ecc
[Cosmos] Item Create/Read/Replace/Upsert/Delete (#1830) 2024-10-04 10:42:37 -07:00
Heath Stewart c877711d82
Always return `Result<Arc<Self>>` from `new` credential constructors (#1828)
* 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>>`
2024-09-27 16:35:33 -07:00
Heath Stewart 9d5c324abe
Remove ClientSecretCredential, EnvironmentCredential (#1821)
* 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
2024-09-25 16:02:44 -07:00
Heath Stewart 2d5e159e30
Removed unsupported or undesirable credentials (#1807)
* Removed unsupported or undesirable credentials

Fixes #1805 by removing unused flows (we'll use the remaining flows internally) and fixes #1806 by removing support for `azureauth`.

* Fix lint issues

* Fix lint issues against +stable

* Fix docs

* Resolve merge conflict in cosmos

* Rename azure_core::auth to azure_core::credentials

* Fix fmt issue

* Fix doc reference

* Fix wasm32 build
2024-09-19 21:44:54 +00:00
Cameron Taggart dfb354dbb0
support user-assigned identities in VirtualMachineManagedIdentityCredential (#1799) 2024-09-12 17:18:27 +00:00
Heath Stewart 78ac814e0f
Better centralize and remove unused dependencies (#1798)
* Better centralize and remove unused dependencies

* Fix clippy errors

* Fix wasm32 build
2024-09-12 09:19:02 -07:00
Heath Stewart 6aedb1017f
General client core refactoring (#1793) 2024-09-09 13:35:29 -07:00
Ashley Stanton-Nurse e6cc2951f1
Derive Macro for `typespec_client_core::http::Model` (#1772) 2024-09-09 12:32:11 -07:00
Heath Stewart 759a012e79
Add copyright headers to all .rs source files (#1788)
* Add copyright headers to all .rs source files

* Add datetime to dictionary
2024-09-03 23:55:38 +00:00
Heath Stewart 2593adb170
Fix some all-features build issues (#1782) 2024-08-29 20:48:19 +00:00
Ashley Stanton-Nurse bddff2b6c5
Take 2: Refactoring Response<T> to collapse json/xml methods (#1724)
* 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 :(
2024-08-26 14:34:07 -07:00
Heath Stewart c73169f3a0
Refactors most of azure_core to typespec (#1751)
* 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.
2024-08-16 11:09:57 -07:00
Brian Caswell 4d5a7a0bda
move is_expired to be a method on AccessToken (#1752) 2024-08-14 16:35:17 -04:00
Heath Stewart 055e07cb8d
Refactor json and xml mods into typespec crate (#1736)
* Refactor json and xml mods into typespec crate

* Move json, xml mods back up to typespec_client_core

* Fix docs build
2024-08-05 14:23:36 -07:00
Heath Stewart a523ab295a
Refactor general implementation into TypeSpec crates (#1710)
* 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
2024-08-02 00:32:40 +00:00
Heath Stewart 9968664b53
Configure and fix spelling issues (#1730) 2024-08-01 17:11:48 -07:00
Heath Stewart 890667e96a
Fix year in changelog (#1719)
Co-authored-by: Robert Collins <robert.collins@cognite.com>
2024-07-30 15:02:55 -07:00
Heath Stewart 9f8bdda664
Fix new clippy lints (#1723) 2024-07-30 18:29:27 +00:00
Robert Collins 2f7879f706
Fix year in changelog (#1673) 2024-07-29 20:33:30 +00:00
Larry Osterman a7f72044f4
Fixed DefaultAzureCredential CI pipeline error (#1717) 2024-07-26 16:55:04 -07:00
Heath Stewart a96b6b6243
Fix broken code behind client_certificate feature (#1706)
* 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>
2024-07-17 20:57:23 -07:00
Heath Stewart 6c06ee8472
Move crates into subdirs under service dirs (#1705)
* 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
2024-07-17 16:04:08 -07:00
Heath Stewart acbe066e10
Return `Response<T>` from client methods (#1688)
* 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
2024-06-26 10:00:37 -07:00
Heath Stewart a80e97473d
Support hierarchical Context (#1684)
* 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
2024-06-25 09:37:43 -07:00
Brian Caswell e64d27c710
Prep 0.20.0 release (#1648)
* Prep 0.20.0 release
2024-04-24 12:19:40 -04:00
Merlin d5b8a4c2a1
Support xml error respsonse (#1631)
* 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>
2024-04-19 07:58:27 +02:00
Heath Stewart e3e174e146
Use package properties, dependencies (#1642)
* Use package properties, dependencies

* Fix build breaks

* Checkout source before linting
2024-04-18 15:38:26 -07:00
Heath Stewart 201aaae2c5
Remove all but core, identity (#1641)
* Remove all but core, identity

* Disable emulator tests
2024-04-18 15:29:01 -07:00
dependabot[bot] 9f737e154c
Update reqwest requirement from 0.11.14 to 0.12.0 (#1626)
Updates the requirements on [reqwest](https://github.com/seanmonstar/reqwest) to permit the latest version.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.14...v0.12.0)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-21 15:10:58 -07:00
Thomas Johnson f72ad46310
fix: naive_redirect_server TCP Port should be a u16 (#1611)
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.
2024-02-20 16:29:40 -08:00
Heath Stewart 9d112d18b4
Fix build errors (#1613) 2024-02-20 15:58:55 -08:00
Brian Caswell f473bc948c
move to using `tracing` instead of `log` (#1579)
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
2024-01-22 10:10:59 -05:00
Cameron Taggart b28ca1d05c
add azure_identity::create_credential(), SpecificAzureCredential, AppServiceManagedIdentityCredential, VirtualMachineManagedIdentityCredential (#1532)
* add azure_identity::new_credential(), SpecificAzureCredential, AppServiceManagedIdentityCredential, VirtualMachineManagedIdentityCredential

* examples

* clippy NoopClient

* clippy test_options

* rename feature to unit_test

* spelling

* "noop_client"

* rename as create_sources

* fix compilation

* remove SpecificAzureCredential from DefaultAzureCredential

* add create_default_credential

* add create_specific_credential

* use create_credential

* update changelog

* make Env pub(crate)

* authority_host URL parsing in create

* cargo test --all

* update vm_list example

* vm_list

* create_credential docs

* back out noop_client feature

* make noop_client private

* opt out of cli for wasm

* make ImdsManagedIdentityCredential internal

* all spaces in AZURE_CREDENTIAL_TYPE

* clippy

* Update sdk/identity/README.md

Co-authored-by: Heath Stewart <heaths@outlook.com>

* Update sdk/identity/CHANGELOG.md

Co-authored-by: Heath Stewart <heaths@outlook.com>

* ./eng/scripts/cargo_readme.sh

* rename to Kind

* rename as AZURE_CREDENTIAL_KIND

* add DefaultAzureCredential::create

* put back VM credential by default :-(

* env is not pub

---------

Co-authored-by: Heath Stewart <heaths@outlook.com>
2024-01-16 14:51:56 -08:00
Kyle Rader decf450b34
Upgrade AzureauthCliCredential to latest TokenCredential trait and use TokenCache (#1575) 2024-01-16 10:06:53 -05:00
Brian Caswell 9cd67babbf
use async-process for executing commands (#1560) 2024-01-09 21:23:26 -05:00
Brian Caswell 74271f9dbf
address `clippy::doc_markdown` (#1562) 2024-01-09 19:10:28 -05:00
Brian Caswell ce0cfe00ec
address `clippy::inefficient_to_string` (#1568) 2024-01-09 19:09:46 -05:00
Brian Caswell b65164834a
address `clippy::if_not_else` (#1570) 2024-01-09 19:09:16 -05:00
dependabot[bot] 9b2bd2e54a
Update serial_test requirement from 2.0 to 3.0 (#1556)
Updates the requirements on [serial_test](https://github.com/palfrey/serial_test) to permit the latest version.
- [Release notes](https://github.com/palfrey/serial_test/releases)
- [Commits](https://github.com/palfrey/serial_test/compare/v2.0.0...v3.0.0)

---
updated-dependencies:
- dependency-name: serial_test
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 10:13:28 -05:00
Brian Caswell 1936e9be73
Prep 0.19.0 release (#1551) 2024-01-05 14:01:36 -05:00
Brian Caswell 612e0d551c
include source stack in aggregated errors in DefaultAzureCredential (#1546)
* 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/
```
2024-01-05 13:36:54 -05:00
Cameron Taggart 207cb5467a
use expire_on from Azure CLI 2.54.0 if it exists (#1534)
* use expire_on from Azure CLI 2.54.0

* spelling

* rename to local_expires_on & expires_on

* fix test
2024-01-02 14:58:21 -05:00
Brian Caswell aac41053c0
fix hmac features related to docs.rs build failures (#1513) 2023-12-11 11:56:28 -05:00
Brian Caswell e04f5c3590
Bump version for release (#1508) 2023-12-08 14:40:25 -05:00
Brian Caswell 85d13b31d5
Standardize on json & xml helpers (#1505) 2023-12-08 08:59:14 -05:00