@azure/core-client package
Classes
ServiceClient |
Initializes a new instance of the ServiceClient. |
Interfaces
AdditionalPolicyConfig |
Used to configure additional policies added to the pipeline at construction. |
BaseMapper |
The base definition of a mapper. Can be used for XML and plain JavaScript objects. |
CommonClientOptions |
The common set of options that high level clients are expected to expose. |
CompositeMapper |
A mapper composed of other mappers. |
CompositeMapperType |
Helps build a mapper that describes how to map a set of properties of an object based on other mappers. Only one of the following properties should be present: |
DeserializationContentTypes |
The content-types that will indicate that an operation response should be deserialized in a particular way. |
DeserializationPolicyOptions |
Options to configure API response deserialization. |
DictionaryMapper |
A mapper describing plain JavaScript objects used as key/value pairs. |
DictionaryMapperType |
Helps build a mapper that describes how to parse a dictionary of mapped values. |
EnumMapper |
A mapper describing an enum value. |
EnumMapperType |
Helps build a mapper that describes how to parse an enum value. |
FullOperationResponse |
Wrapper object for http request and response. Deserialized object is stored in
the |
InternalClientPipelineOptions |
Options for creating a Pipeline to use with ServiceClient. Mostly for customizing the auth policy (if using token auth) or the deserialization options when using XML. |
MapperConstraints |
Description of various value constraints such as integer ranges and string regex. |
OperationArguments |
A collection of properties that apply to a single invocation of an operation. |
OperationOptions |
The base options type for all operations. |
OperationParameter |
A common interface that all Operation parameter's extend. |
OperationQueryParameter |
A parameter for an operation that will be added as a query parameter to the operation's HTTP request. |
OperationRequestInfo |
Metadata that is used to properly parse a response. |
OperationRequestOptions |
Options used when creating and sending HTTP requests for this operation. |
OperationResponseMap |
An OperationResponse that can be returned from an operation request for a single status code. |
OperationSpec |
A specification that defines an operation. |
OperationURLParameter |
A parameter for an operation that will be substituted into the operation's request URL. |
PolymorphicDiscriminator |
Used to disambiguate discriminated type unions. For example, if response can have many shapes but also includes a 'kind' field (or similar), that field can be used to determine how to deserialize the response to the correct type. |
SequenceMapper |
A mapper describing arrays. |
SequenceMapperType |
Helps build a mapper that describes how to parse a sequence of mapped values. |
SerializationPolicyOptions |
Options to configure API request serialization. |
Serializer |
Used to map raw response objects to final shapes. Helps packing and unpacking Dates and other encoded types that are not intrinsic to JSON. Also allows pulling values from headers, as well as inserting default values and constants. |
SerializerOptions |
Options to configure serialization/de-serialization behavior. |
ServiceClientOptions |
Options to be provided while creating the client. |
SimpleMapperType |
The type of a simple mapper. |
SpanConfig |
Configuration for creating a new Tracing Span |
XmlOptions |
Options to govern behavior of xml parser and builder. |
Type Aliases
Mapper |
Mappers are definitions of the data models used in the library. These data models are part of the Operation or Client definitions in the responses or parameters. |
MapperType |
Type of the mapper. Includes known mappers. |
OperationRequest |
A type alias for future proofing. |
ParameterPath |
Encodes how to reach a particular property on an object. |
QueryCollectionFormat |
The format that will be used to join an array of values together for a query parameter value. |
RawResponseCallback |
A function to be called each time a response is received from the server while performing the requested operation. May be called multiple times. |
Functions
authorize |
This function can be used as a callback for the Call the
Once provided, the Example challenge with claims:
|
authorize |
Defines a callback to handle auth challenge for Storage APIs. This implements the bearer challenge process described here: https://docs.microsoft.com/rest/api/storageservices/authorize-with-azure-active-directory#bearer-challenge Handling has specific features for storage that departs to the general AAD challenge docs. |
create |
Creates a new Pipeline for use with a Service Client. Adds in deserializationPolicy by default. Also adds in bearerTokenAuthenticationPolicy if passed a TokenCredential. |
create |
Method that creates and returns a Serializer. |
deserialization |
This policy handles parsing out responses according to OperationSpecs on the request. |
serialization |
This policy handles assembling the request body and headers using an OperationSpec and OperationArguments on the request. |
Function Details
authorizeRequestOnClaimChallenge(AuthorizeRequestOnChallengeOptions)
This function can be used as a callback for the bearerTokenAuthenticationPolicy
of @azure/core-rest-pipeline
, to support CAE challenges:
Continuous Access Evaluation.
Call the bearerTokenAuthenticationPolicy
with the following options:
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
import { authorizeRequestOnClaimChallenge } from "@azure/core-client";
const bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy({
authorizeRequestOnChallenge: authorizeRequestOnClaimChallenge
});
Once provided, the bearerTokenAuthenticationPolicy
policy will internally handle Continuous Access Evaluation (CAE) challenges.
When it can't complete a challenge it will return the 401 (unauthorized) response from ARM.
Example challenge with claims:
Bearer authorization_uri="https://login.windows-ppe.net/", error="invalid_token",
error_description="User session has been revoked",
claims="eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTYwMzc0MjgwMCJ9fX0="
function authorizeRequestOnClaimChallenge(onChallengeOptions: AuthorizeRequestOnChallengeOptions): Promise<boolean>
Parameters
- onChallengeOptions
- AuthorizeRequestOnChallengeOptions
Returns
Promise<boolean>
authorizeRequestOnTenantChallenge(AuthorizeRequestOnChallengeOptions)
Defines a callback to handle auth challenge for Storage APIs. This implements the bearer challenge process described here: https://docs.microsoft.com/rest/api/storageservices/authorize-with-azure-active-directory#bearer-challenge Handling has specific features for storage that departs to the general AAD challenge docs.
function authorizeRequestOnTenantChallenge(challengeOptions: AuthorizeRequestOnChallengeOptions): Promise<boolean>
Parameters
- challengeOptions
- AuthorizeRequestOnChallengeOptions
Returns
Promise<boolean>
createClientPipeline(InternalClientPipelineOptions)
Creates a new Pipeline for use with a Service Client. Adds in deserializationPolicy by default. Also adds in bearerTokenAuthenticationPolicy if passed a TokenCredential.
function createClientPipeline(options?: InternalClientPipelineOptions): Pipeline
Parameters
- options
- InternalClientPipelineOptions
Options to customize the created pipeline.
Returns
createSerializer({[key: string]: any}, boolean)
Method that creates and returns a Serializer.
function createSerializer(modelMappers?: {[key: string]: any}, isXML?: boolean): Serializer
Parameters
- modelMappers
-
{[key: string]: any}
Known models to map
- isXML
-
boolean
If XML should be supported
Returns
deserializationPolicy(DeserializationPolicyOptions)
This policy handles parsing out responses according to OperationSpecs on the request.
function deserializationPolicy(options?: DeserializationPolicyOptions): PipelinePolicy
Parameters
- options
- DeserializationPolicyOptions
Returns
serializationPolicy(SerializationPolicyOptions)
This policy handles assembling the request body and headers using an OperationSpec and OperationArguments on the request.
function serializationPolicy(options?: SerializationPolicyOptions): PipelinePolicy
Parameters
- options
- SerializationPolicyOptions