NAME

Azure::SDK::Core::Policy - policy contract for the Perl Azure SDK pipeline

SYNOPSIS

use Azure::SDK::Core::Policy;

class My::Policy :isa(Azure::SDK::Core::Policy) {
    method send ($context, $request, $next) {
        $request->set_header('x-ms-custom', 'value');
        return $next->($context, $request);
    }
}

DESCRIPTION

Azure::SDK::Core::Policy documents the contract every pipeline policy implements. A policy is a small class with a single send method. It may inspect or mutate the request and context, then must call $next to invoke the next policy or the transport, and finally may inspect or mutate the returned response.

Policies are held in a plain ordered array inside Azure::SDK::Core::Pipeline. There is no dynamic plugin discovery: ordering is explicit and easy to reason about.

Per-call versus per-try

Per-call policies run once per logical operation (for example header shaping, telemetry, and diagnostics). Per-try policies run again on every retry attempt (for example applying a credential). The retry policy is the boundary between the two groups.

METHODS

send

my $response = $policy->send($context, $request, $next);

Processes the request and returns an Azure::SDK::Core::Response. $next is a coderef invoked as $next->($context, $request). The base implementation throws; subclasses must override it.

SEE ALSO

Azure::SDK::Core::Pipeline, Azure::SDK::Core::Policy::Retry