AWS-CloudFront
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/AWS/CloudFront/Distribution.pm view on Meta::CPAN
required => 1,
lazy => 1,
default => sub {
my $s = shift;
$s->cf->distribution( Id => $s->Id )->CallerReference
},
);
has 'CNAME' => (
is => 'rw',
isa => 'Str',
required => 0,
);
has 'Comment' => (
is => 'ro',
isa => 'Str',
required => 0,
);
has 'Enabled' => (
is => 'rw',
isa => 'Bool',
required => 1,
);
has 'DefaultRootObject' => (
is => 'rw',
isa => 'Str',
required => 0,
);
has 'Logging' => (
is => 'ro',
isa => 'AWS::CloudFront::Logging',
required => 0,
);
has 'TrustedSigners' => (
is => 'ro',
isa => 'ArrayRef[AWS::CloudFront::TrustedSigner]',
required => 0,
);
has 'OriginAccessIdentity' => (
is => 'ro',
isa => 'Maybe[AWS::CloudFront::OriginAccessIdentity]',
required => 0,
lazy => 1,
default => sub {
my $s = shift;
foreach my $ident ( $s->cf->origin_access_identities )
{
}# end foreach()
}
);
sub update
{
my $s = shift;
my $type = 'UpdateDistribution';
my $response = $s->cf->request( $type, Distribution => $s )->request();
if( $response->error_code )
{
die $response->msg;
}# end if()
}# end update()
sub delete
{
my $s = shift;
my $type = 'DeleteDistribution';
my $response = $s->cf->request( $type, Id => $s->Id )->request();
if( $response->error_code )
{
die $response->msg;
}# end if()
}# end delete()
sub create_origin_access_identity
{
my ($s, %args) = @_;
my $type = 'CreateOriginAccessIdentity';
my $response = $s->cf->request( $type,
CallerReference => $s->CallerReference,
Comment => $args{Comment}
)->request();
if( $response->error_code )
{
die $response->msg;
}# end if()
my $xpc = $response->xpc;
if( my ($node) = $xpc->findnodes('.//cf:CloudFrontOriginAccessIdentity') )
{
return AWS::CloudFront::OriginAccessIdentity->new(
Id => $xpc->findvalue('.//cf:Id', $node),
S3CanonicalUserId => $xpc->findvalue('.//cf:S3CanonicalUserId', $node),
CallerReference => $xpc->findvalue('.//cf:CallerReference', $node),
Location => $response->response->header('Location'),
);
}
elsif( my ($error) = $xpc->findnodes('.//cf:Error') )
{
if( my ($code) = $response->response->content =~ m{<Code>(.+?)</Code>}s )
{
# The origin already exists or some other error.
die $code;
}
else
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.569 second using v1.00-cache-2.02-grep-82fe00e-cpan-b63e86051f13 )