me qw(basename fileparse dirname);
use File::Temp qw(tempfile tempdir);
use IPC::Run qw(run);
use JSON;
use Readonly;
use Role::Tiny::With;
with 'App::Logger';
with 'App::BenchmarkRole';
Readonly::
oleans :chars);
use Data::Dumper;
use Digest::MD5 qw(md5_hex);
use English qw(no_match_vars);
use JSON;
use Storable qw(dclone);
use Role::Tiny;
#####################################################
my ( $self, $waf_config ) = @_;
my @rule_list;
my $priority = 1;
my $rule_stub = decode_json($WAF_RULE_STUB);
if ( !$waf_config->{managed_rules} ) {
$waf_config->{managed_rules} = [qw
waf => $waf, waf_config => $waf_config );
# check to see if someone has mucked with web-acl.json
my $needs_update = $self->check_web_acl_state(
name => $name,
id =>
Route53;
use strict;
use warnings;
use Carp;
use File::Temp qw(tempfile);
use Data::Dumper;
use JSON;
use App::FargateStack::Constants;
use Role::Tiny::With;
with 'App::AWS';
use parent 'App::Comm
ne_id,
DNSName => $alb_dns_name,
EvaluateTargetHealth => JSON::false,
}
}
}
]
}
};
return $self->change_resource_r
'.json'
);
print {$fh} encode_json($change_batch);
close $fh;
return $self->command(
'change-resource-record-sets' => [
'--hosted-zone-id' => $zone_id,
'--cli-input-json' =
h qw(-no_match_vars);
use File::Temp qw(tempfile);
use CLI::Simple::Constants qw(:booleans);
use JSON;
use Scalar::Util qw(reftype);
use Role::Tiny::With;
with 'App::AWS';
use parent qw(App::Comman
_token,
$description ? ( '--description' => $description ) : (),
'--cli-input-json' => encode_json( { RegularExpressionList => $regex_list } ),
$query ? ( '--query' => $query ) : (),
$filename ) = tempfile( 'rulesXXXX', UNLINK => $ENV{NO_UNLINK} ? $FALSE : $TRUE );
print {$fh} JSON->new->pretty->encode($rules);
close $fh;
return $filename;
}
#############################
rail;
use strict;
use warnings;
use Carp;
use Data::Dumper;
use English qw(-no_match_vars);
use JSON;
use Role::Tiny::With;
with 'App::AWS';
use parent qw(App::Command);
__PACKAGE__->follow_best_
ble to lookup events' );
foreach ( @{ $result->{Events} } ) {
$_->{CloudTrailEvent} = from_json( $_->{CloudTrailEvent} );
}
return $result->{Events};
}
###################################
package App::IAM;
use strict;
use warnings;
use Carp;
use Data::Dumper;
use JSON;
use English qw(-no_match_vars);
use File::Temp qw(tempfile);
use Role::Tiny::With;
with 'App::AWS';
use parent qw(
= $self->get_policy_document;
my ( $json_path, $fh ) = tempfile( 'policy-XXXXX', UNLINK => $self->get_unlink, SUFFIX => '.json' );
print {$fh} encode_json($doc);
close $fh;
my @cmd = (
s', 'iam', 'create-policy',
'--policy-name' => $name,
'--policy-document' => "file://$json_path",
'--profile' => $self->profile,
);
return $self->execute(@cmd);
}
#######
package App::ACM;
use strict;
use warnings;
use Role::Tiny::With;
use JSON;
use File::Temp qw(tempfile);
use Data::Dumper;
with 'App::AWS';
use parent 'App::Command';
__PACKAGE__->follow_best_pra
bucket_name;
if ( $policy =~ /[.]json$/xms && -s $policy ) {
$policy = '--cli-input-json ' . $policy;
}
elsif ( $policy =~ /\s*{/xsm && eval { decode_json($policy) } ) {
$policy = '--po
stants;
use Carp;
use Data::Dumper;
use English qw(-no_match_vars);
use List::Util qw(pairs);
use JSON;
use Role::Tiny::With;
with 'App::AWS';
use parent qw(App::Command);
__PACKAGE__->mk_accessor
ePolicy} ) {
$queue_attributes{RedrivePolicy} = encode_json( $queue_attributes{RedrivePolicy} );
}
$attributes = encode_json( \%queue_attributes );
}
return $self->command(
'se
encode_json(
{ deadLetterTargetArn => $dlq->{arn},
maxReceiveCount => $max_receive_count, # must be string not an int
}
);
}
my $attribute_payload = encode_json( \%qu
stants;
use Carp;
use Data::Dumper;
use English qw(-no_match_vars);
use List::Util qw(none);
use JSON;
use Role::Tiny;
use parent qw(Class::Accessor::Fast);
__PACKAGE__->follow_best_practice();
__
my $obj = eval {
return $result
if join( q{}, @args ) =~ /outputtext/xsm;
return JSON->new->utf8->decode($result);
};
if ( !$obj || $EVAL_ERROR ) {
$self->get_logger->error($
gs;
my $options = $self->fetch_option_defaults;
my $defaults_file = '.fargatestack/defaults.json';
if ($config_name) {
my ( $name, $path, $ext ) = fileparse( $config_name, qr/[.][^.]+$/xs
ile not found: [%s]\n", $fqp
if !-s $fqp;
$options->{config} = $fqp;
$self->write_json_file( $defaults_file, $options );
$config_name = $name;
}
my $data = [
{ Profile
action, $ENV{SCRIPT_NAME} )
if !$task_name;
my $task_definition_file = sprintf 'taskdef-%s.json', $task_name;
$self->check_task($task_name);
log_die( $self, "ERROR: no task definition fil
nts;
use Carp;
use Data::Dumper;
use English qw(-no_match_vars);
use File::Temp qw(tempfile);
use JSON;
use List::Util qw(none any);
use Scalar::Util qw(reftype);
use Role::Tiny::With;
with 'App::AWS
le-XXXXX',
UNLINK => $self->get_unlink,
SUFFIX => '.json'
);
my $json = JSON->new->pretty->encode($target);
print {$fh} $json;
close $fh;
return $self->command(
'put-targets'
trict;
use warnings;
use App::EC2;
use Carp;
use Data::Dumper;
use List::Util qw(first any);
use JSON;
use Role::Tiny::With;
with 'App::AWS';
use parent 'App::Command';
__PACKAGE__->follow_best_pr
'--certificates' => "CertificateArn=$certificate_arn",
'--default-actions' => encode_json($default_action),
]
);
}
#################################################################
file,
'--query' => $query;
my $result = $self->execute(@cmd);
return $result ? decode_json($result) : $result;
}
########################################################################
s
s;
use Carp;
use Data::Dumper;
use File::Temp qw(tempfile);
use List::Util qw(any none uniq);
use JSON;
use Text::ASCIITable::EasyTable;
use Role::Tiny::With;
with 'App::AWS';
use parent 'App::Comma
;
use JSON;
use List::Util qw(any none);
use Scalar::Util qw(blessed reftype refaddr looks_like_number);
use Term::ANSIColor;
use Time::Piece;
use Time::HiRes qw(time);
use Text::Diff;
use JSON;
use
normalize_name
normalize_time_range
normalize_timestamp
toCamelCase
slurp_file
write_json_file
fetch_acm
fetch_cloudtrail
fetch_application_autoscaling
fetch_ecr
fetch_ec2
fet
$old, $new, $options ) = @_;
my $json = JSON->new->canonical->pretty->allow_blessed->convert_blessed;
my $old_str = $json->encode($old);
my $new_str = $json->encode($new);
# normalize line
use warnings;
use Data::Dumper;
use English qw(-no_match_vars);
use List::Util qw(none any);
use JSON;
use App::FargateStack::Constants;
use App::FargateStack::Builder::Utils qw(log_die);
use Role:
t = $self->has_https_service;
foreach my $port (@ports) {
$default_actions{$port} = encode_json( $default_actions{$port} );
# create listener returns listener configuration (uses --query)
teStack::Constants;
use App::FargateStack::Builder::Utils qw(choose log_die);
use Text::Diff;
use JSON;
use Role::Tiny;
########################################################################
sub b
no_match_vars);
use File::Basename qw(fileparse);
use Data::Compare;
use List::Util qw(uniq);
use JSON;
use Test::More;
use Role::Tiny;
##############################################################
sks->{$task_name}->{arn};
}
]
);
my $task_definition = sprintf 'taskdef-%s.json', $task_name;
$self->log_warn(
'register-task-definition: task definition for [%s] cha
###
my ( $self, $task, $action ) = @_;
$action //= 'status';
my $taskdef = "taskdef-$task.json";
my ( $name, $path, $ext ) = fileparse( $taskdef, qr/[.][^.]+$/xsm );
return !$self->get_t
ck::Constants;
use Carp;
use Data::Compare;
use Data::Dumper;
use English qw(-no_match_vars);
use JSON;
use Role::Tiny;
########################################################################
sub b
=> 'schedule:' . $task_name,
EnableECSManagedTags => JSON::true,
EnableExecuteCommand => JSON::false,
PropagateTags => 'TASK_DEFINITION',
NetworkC
k_result(
message => 'ERROR: could not create target [%s] for rule [%s]',
params => [ to_json( $target, { pretty => $TRUE } ), $rule_name ]
);
return;
}
################################
use Data::Dumper;
use English qw(-no_match_vars);
use List::Util qw(none any uniq pairs max);
use JSON;
use App::FargateStack::AutoscalingConfig;
use App::FargateStack::Constants;
use App::FargateSta
ource_id,
policy_type => 'TargetTrackingScaling',
policy_configuration => encode_json($policy_configuration),
);
$app_autoscaling->check_result( message => 'ERROR: could not crea
=> $resource_id,
schedule => $schedule,
scalable_target_action => encode_json($action),
name => $self->create_default( 'scheduled-action-name', $action_n