Skip to content

Commit

Permalink
Update azure_core, azure_identity to 0.18 (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbatty authored Dec 11, 2023
1 parent 70506b4 commit 5bdcbb6
Show file tree
Hide file tree
Showing 44 changed files with 977 additions and 976 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changes

- Upgrade `azure_core`, `azure_identity` to 0.18
- Note: `AutoRefreshingTokenCredential` is no longer required (and has been removed from `azure_identity`), as token refreshing is now built in to each credential provider

### [0.14.3]

### Added
Expand Down
2 changes: 1 addition & 1 deletion autorust/codegen/src/codegen_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ struct AuthCode {}
impl ToTokens for AuthCode {
fn to_tokens(&self, tokens: &mut TokenStream) {
tokens.extend(quote! {
if let Some(auth_header) = this.client.token_credential().http_authorization_header(&this.client.scopes).await? {
if let Some(auth_header) = this.client.token_credential().http_authorization_header(&this.client.scopes()).await? {
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
})
Expand Down
4 changes: 2 additions & 2 deletions azure_devops_rust_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rust-version = "1.64.0"
doctest = false

[dependencies]
azure_core = { version = "0.17", default-features = true }
azure_core = { version = "0.18", default-features = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
bytes = "1.0"
Expand All @@ -32,7 +32,7 @@ base64 = "0.21"
time = "0.3"

[dev-dependencies]
azure_identity = "0.17"
azure_identity = "0.18"
tokio = { version = "1.0", features = ["full"] }
anyhow = "1"
log = "0.4"
Expand Down
8 changes: 2 additions & 6 deletions azure_devops_rust_api/examples/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use async_trait::async_trait;
use azure_core::{Context, Policy, PolicyResult, Request};
use azure_devops_rust_api::Credential;
use azure_identity::{AutoRefreshingTokenCredential, DefaultAzureCredentialBuilder};
use azure_identity::DefaultAzureCredentialBuilder;
use std::sync::Arc;

fn authenticate_with_default_credential() -> Credential {
Expand All @@ -24,11 +24,7 @@ fn authenticate_with_default_credential() -> Credential {
.build(),
);

// Use the `AutoRefreshingTokenCredential` wrapper to cache the credentials,
// refreshing when required.
let auto_refreshing_credential =
Arc::new(AutoRefreshingTokenCredential::new(default_azure_credential));
Credential::from_token_credential(auto_refreshing_credential)
Credential::from_token_credential(default_azure_credential)
}

#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion azure_devops_rust_api/src/accounts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ pub mod accounts {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down
28 changes: 14 additions & 14 deletions azure_devops_rust_api/src/approvals_and_checks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ pub mod pipeline_permissions {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -410,7 +410,7 @@ pub mod pipeline_permissions {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -525,7 +525,7 @@ pub mod pipeline_permissions {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -778,7 +778,7 @@ pub mod check_configurations {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -902,7 +902,7 @@ pub mod check_configurations {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -1017,7 +1017,7 @@ pub mod check_configurations {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -1132,7 +1132,7 @@ pub mod check_configurations {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -1209,7 +1209,7 @@ pub mod check_configurations {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -1326,7 +1326,7 @@ pub mod check_configurations {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -1493,7 +1493,7 @@ pub mod check_evaluations {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -1612,7 +1612,7 @@ pub mod check_evaluations {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -1799,7 +1799,7 @@ pub mod approvals {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -1916,7 +1916,7 @@ pub mod approvals {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down Expand Up @@ -2030,7 +2030,7 @@ pub mod approvals {
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
Expand Down
Loading

0 comments on commit 5bdcbb6

Please sign in to comment.