Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
script to do purging and little cleanup of Fastly
- Loading branch information
Showing
3 changed files
with
151 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
|
||
# Purge stuff | ||
|
||
=head1 NAME | ||
purge.pl | ||
=head1 SYNOPSIS | ||
purge.pl --all | ||
purge.pl --tag foo --tag bar | ||
purge.pl --url '/about/' | ||
=head1 DESCRIPTION | ||
Script to purge things from Fastly CDN. | ||
=cut | ||
|
||
use MetaCPAN::Web; | ||
use Getopt::Long::Descriptive; | ||
use List::MoreUtils qw(any); | ||
|
||
my ( $opt, $usage ) = describe_options( | ||
'purge.pl %o <some-arg>', | ||
[ 'all=s', "purge all", ], | ||
[ 'tag|t=s@', "tag(s) to purge", ], | ||
[ 'url|t=s@', "url(s) to purge", ], | ||
[], | ||
[ 'help', "print usage message and exit" ], | ||
); | ||
|
||
print( $usage->text ), exit if $opt->help; | ||
|
||
my $c = MetaCPAN::Web->new(); | ||
|
||
if ( $opt->all ) { | ||
$c->cdn_purge_all(); | ||
|
||
} | ||
else { | ||
|
||
my $tags = $opt->tag; | ||
my $urls = $opt->url; | ||
|
||
$c->cdn_purge_now( | ||
{ | ||
tags => $tags, | ||
urls => $urls | ||
} | ||
); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters