Skip to content

Commit a5835c1

Browse files
Enabled doc comments in azure_core and azure_identity packages (#2990)
Also: Removed a significant number of unused HTTP headers from azure_core.
1 parent 98bbe10 commit a5835c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+673
-1243
lines changed

sdk/core/azure_core/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
### Breaking Changes
88

9+
- Removed several unreferenced HTTP headers and accessor structures for those headers.
10+
911
### Bugs Fixed
1012

1113
### Other Changes

sdk/core/azure_core/src/credentials.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ pub static DEFAULT_SCOPE_SUFFIX: &str = "/.default";
1717
pub struct Secret(Cow<'static, str>);
1818

1919
impl Secret {
20+
/// Create a new `Secret`.
2021
pub fn new<T>(access_token: T) -> Self
2122
where
2223
T: Into<Cow<'static, str>>,
2324
{
2425
Self(access_token.into())
2526
}
2627

28+
/// Get the secret value.
2729
pub fn secret(&self) -> &str {
2830
&self.0
2931
}
@@ -90,6 +92,7 @@ impl AccessToken {
9092
/// Options for getting a token from a [`TokenCredential`]
9193
#[derive(Clone, Default, SafeDebug)]
9294
pub struct TokenRequestOptions<'a> {
95+
/// Method options to be used when requesting a token.
9396
pub method_options: ClientMethodOptions<'a>,
9497
}
9598

sdk/core/azure_core/src/error/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
//! Error types and handling.
45
pub use typespec_client_core::error::*;
56
mod error_response;
67

sdk/core/azure_core/src/http/headers.rs

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,19 @@ pub use typespec_client_core::http::headers::*;
99
// HTTP headers are case-insensitive.
1010
// We use lowercase below for simple comparisons downstream.
1111

12-
pub const ACCOUNT_KIND: HeaderName = HeaderName::from_static("x-ms-account-kind");
13-
pub(crate) const ACTIVITY_ID: HeaderName = HeaderName::from_static("x-ms-activity-id");
14-
pub(crate) const APP: HeaderName = HeaderName::from_static("x-ms-app");
15-
pub const APPEND_POSITION: HeaderName = HeaderName::from_static("x-ms-blob-condition-appendpos"); // cspell:ignore appendpos
16-
pub const AZURE_ASYNCOPERATION: HeaderName = HeaderName::from_static("azure-asyncoperation");
17-
pub(crate) const BLOB_SEQUENCE_NUMBER: HeaderName =
18-
HeaderName::from_static("x-ms-blob-sequence-number");
12+
/// x-ms-client-request-id header. See <https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#distributed-tracing--telemetry> for more details.
1913
pub const CLIENT_REQUEST_ID: HeaderName = HeaderName::from_static("x-ms-client-request-id");
20-
pub(crate) const CLIENT_VERSION: HeaderName = HeaderName::from_static("x-ms-client-version");
21-
pub(crate) const CONTENT_DISPOSITION: HeaderName =
22-
HeaderName::from_static("x-ms-blob-content-disposition");
23-
pub(crate) const CONTINUATION: HeaderName = HeaderName::from_static("x-ms-continuation");
14+
/// x-ms-error-code header. See <https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors> for more details.
2415
pub const ERROR_CODE: HeaderName = HeaderName::from_static("x-ms-error-code");
25-
pub(crate) const IF_SEQUENCE_NUMBER_EQ: HeaderName =
26-
HeaderName::from_static("x-ms-if-sequence-number-eq");
27-
pub(crate) const IF_SEQUENCE_NUMBER_LE: HeaderName =
28-
HeaderName::from_static("x-ms-if-sequence-number-le");
29-
pub(crate) const IF_SEQUENCE_NUMBER_LT: HeaderName =
30-
HeaderName::from_static("x-ms-if-sequence-number-lt");
31-
pub(crate) const IF_TAGS: HeaderName = HeaderName::from_static("x-ms-if-tags");
32-
pub(crate) const LEASE_BREAK_PERIOD: HeaderName =
33-
HeaderName::from_static("x-ms-lease-break-period");
34-
pub(crate) const LEASE_DURATION: HeaderName = HeaderName::from_static("x-ms-lease-duration");
35-
pub(crate) const LEASE_ID: HeaderName = HeaderName::from_static("x-ms-lease-id");
36-
pub(crate) const MAX_ITEM_COUNT: HeaderName = HeaderName::from_static("x-ms-max-item-count");
16+
/// x-ms-date header.
3717
pub const MS_DATE: HeaderName = HeaderName::from_static("x-ms-date");
38-
pub(crate) const MS_RANGE: HeaderName = HeaderName::from_static("x-ms-range");
39-
pub(crate) const PROPOSED_LEASE_ID: HeaderName = HeaderName::from_static("x-ms-proposed-lease-id");
40-
pub(crate) const RANGE_GET_CONTENT_CRC64: HeaderName =
41-
HeaderName::from_static("x-ms-range-get-content-crc64");
18+
/// x-ms-request-id header. See <https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#distributed-tracing--telemetry> for more details.
4219
pub(crate) const REQUEST_ID: HeaderName = HeaderName::from_static("x-ms-request-id");
20+
/// retry-after-ms header.
4321
pub const RETRY_AFTER_MS: HeaderName = HeaderName::from_static("retry-after-ms");
44-
pub(crate) const SOURCE_IF_MATCH: HeaderName = HeaderName::from_static("x-ms-source-if-match");
45-
pub(crate) const SOURCE_IF_MODIFIED_SINCE: HeaderName =
46-
HeaderName::from_static("x-ms-source-if-modified-since");
47-
pub(crate) const SOURCE_IF_NONE_MATCH: HeaderName =
48-
HeaderName::from_static("x-ms-source-if-none-match");
49-
pub(crate) const SOURCE_IF_UNMODIFIED_SINCE: HeaderName =
50-
HeaderName::from_static("x-ms-source-if-unmodified-since");
51-
pub(crate) const SOURCE_LEASE_ID: HeaderName = HeaderName::from_static("x-ms-source-lease-id");
52-
pub(crate) const USER: HeaderName = HeaderName::from_static("x-ms-user");
22+
/// x-ms-version header.
5323
pub const VERSION: HeaderName = HeaderName::from_static("x-ms-version");
24+
/// x-ms-retry-after-ms header.
5425
pub const X_MS_RETRY_AFTER_MS: HeaderName = HeaderName::from_static("x-ms-retry-after-ms");
5526

5627
/// Constants related to the Content-Type header
@@ -62,11 +33,7 @@ pub mod content_type {
6233
// Form content types
6334
// https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4
6435

36+
/// The content type for form payloads. See <https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4> for more details.
6537
pub const APPLICATION_X_WWW_FORM_URLENCODED: HeaderValue =
6638
HeaderValue::from_static("application/x-www-form-urlencoded");
6739
}
68-
69-
/// Constants related to query parameters
70-
pub mod query_param {
71-
pub const API_VERSION: &str = "api-version";
72-
}

sdk/core/azure_core/src/http/models/lease.rs

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
mod lease;
5-
6-
pub use lease::*;
74
pub use typespec_client_core::http::Etag;

sdk/core/azure_core/src/http/pager.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,17 @@ impl<C: Clone + AsRef<str>> Clone for PagerState<C> {
7676
/// The result of fetching a single page from a [`Pager`], whether there are more pages or paging is done.
7777
pub enum PagerResult<P, C: AsRef<str>> {
7878
/// There are more pages the [`Pager`] may fetch using the `continuation` token.
79-
More { response: P, continuation: C },
79+
More {
80+
/// The response for the current page.
81+
response: P,
82+
/// The continuation token for the next page.
83+
continuation: C,
84+
},
8085
/// The [`Pager`] is done and there are no additional pages to fetch.
81-
Done { response: P },
86+
Done {
87+
/// The response for the current page.
88+
response: P,
89+
},
8290
}
8391

8492
impl<P, F> PagerResult<Response<P, F>, String> {

sdk/core/azure_core/src/http/policies/bearer_token_policy.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub struct BearerTokenCredentialPolicy {
2424
}
2525

2626
impl BearerTokenCredentialPolicy {
27+
/// Creates a new `BearerTokenCredentialPolicy`.
2728
pub fn new<A, B>(credential: Arc<dyn TokenCredential>, scopes: A) -> Self
2829
where
2930
A: IntoIterator<Item = B>,

sdk/core/azure_core/src/http/poller.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,11 @@ pub enum PollerResult<M, N> {
171171
/// * `retry_after` is the optional client-specified [`Duration`] to wait. The default is 30 seconds.
172172
/// * `next` is the next link / continuation token.
173173
InProgress {
174+
/// The HTTP response with the status monitor.
174175
response: Response<M>,
176+
/// The optional client-specified [`Duration`] to wait before polling again.
175177
retry_after: Option<Duration>,
178+
/// The next link / continuation token.
176179
next: N,
177180
},
178181

@@ -181,7 +184,10 @@ pub enum PollerResult<M, N> {
181184
/// # Fields
182185
///
183186
/// * `response` contains the HTTP response with the status monitor in a terminal state.
184-
Done { response: Response<M> },
187+
Done {
188+
/// The HTTP response with the status monitor in a terminal state.
189+
response: Response<M>,
190+
},
185191
}
186192

187193
impl<M: StatusMonitor, N: fmt::Debug> fmt::Debug for PollerResult<M, N> {

sdk/core/azure_core/src/http/request/options/content_range.rs

Lines changed: 0 additions & 189 deletions
This file was deleted.

0 commit comments

Comments
 (0)