NAME

Azure::SDK::Core - shared core client for the Perl Azure SDK

SYNOPSIS

use Azure::SDK::Core;
use Azure::SDK::Core::Request;

my $core = Azure::SDK::Core->new(
    endpoint   => 'http://127.0.0.1:10000/devstoreaccount1',
    credential => $credential,
);

my $request = Azure::SDK::Core::Request->new(
    method => 'GET',
    url    => $core->endpoint . '/?comp=list',
);

my $response = $core->send($request);

DESCRIPTION

Azure::SDK::Core is the shared client every service package builds on. It owns the configured endpoint and an Azure::SDK::Core::ClientOptions, and it lazily builds the policy pipeline that requests flow through. Service clients construct an Azure::SDK::Core::Request and call send; they never talk to the transport directly.

This module migrated from the original blessed-hash scaffold to Perl's core class feature as part of building the shared core. The original accessors (endpoint, api_version, diagnostics_enabled, as_hashref) are preserved.

CONSTRUCTOR

new

Named parameters:

endpoint

Optional service endpoint URL.

options

Optional pre-built Azure::SDK::Core::ClientOptions. When supplied, the convenience parameters below are ignored.

api_version, diagnostics_enabled, credential, transport, logger, max_response_bytes

Optional convenience parameters used to build a default Azure::SDK::Core::ClientOptions when options is not supplied.

METHODS

endpoint

Returns the configured endpoint.

api_version

Returns the API version from the client options.

diagnostics_enabled

Returns whether diagnostics logging is enabled.

pipeline

Returns the lazily-built Azure::SDK::Core::Pipeline.

send

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

Runs an Azure::SDK::Core::Request through the pipeline and returns the resulting Azure::SDK::Core::Response. A fresh Azure::SDK::Core::Context is created when one is not supplied. Non-success responses throw an Azure::SDK::Core::Error. Azure JSON, OData JSON, Blob XML, and RFC problem-details bodies are normalized when present. For problem details, type becomes the error code and title plus detail become the message; the HTTP response status remains authoritative.

as_hashref

Returns a hashref summary of the endpoint, API version, and diagnostics flag.

SEE ALSO

Azure::SDK::Core::ClientOptions, Azure::SDK::Core::Pipeline, Azure::SDK::Core::Request, Azure::SDK::Core::Response