App-FargateStack

 view release on metacpan or  search on metacpan

lib/App/ECS.pm  view on Meta::CPAN

      '--task-definition'       => $task_definition,
      '--desired-count'         => $desired_count,
      '--launch-type'           => 'FARGATE',
      '--network-configuration' => encode_json($network_configuration),
      $load_balancers ? ( '--load-balancers' => encode_json($load_balancers) ) : (),
    ]
  );
}

########################################################################
sub update_service {
########################################################################
  my ( $self, %args ) = @_;

  my ( $cluster_name, $service_name, $task_definition, $force, $desired_count, $query )
    = @args{qw(cluster_name service_name task_definition force desired_count query)};

  $cluster_name //= $self->get_cluster_name;
  $service_name //= $self->get_service_name;

  return $self->command(

lib/App/FargateStack.pm  view on Meta::CPAN

* Note that this command will not force redeployment of your services! To force redeployment of your servicce:

 app-FargateStack redeploy [service-name]

END_OF_NOTE

  return;
}

########################################################################
sub update_task_count {
########################################################################
  my ( $self, $task_name, $desired_count ) = @_;

  my ( $config, $cluster ) = $self->common_args(qw(config cluster));

  my $cluster_name = $cluster->{name};

  $self->verify_service($task_name);

  my $ecs = $self->get_ecs;

lib/App/FargateStack/AutoscalingConfig.pm  view on Meta::CPAN

########################################################################
  my ($self) = @_;

  die 'autoscaling: cpu & requests are mutually exclusive'
    if $self->get_cpu && $self->get_requests;

  return;
}

########################################################################
sub update {
########################################################################
  my ( $self, $key, $value ) = @_;

  $self->get_config->{$key} = $value;

  return $self->set( $key, $value );
}

########################################################################
sub has_scheduled_action {

lib/App/FargateStack/Builder.pm  view on Meta::CPAN

  foreach ( keys %{ $config->{tasks} } ) {
    next if !exists $config->{tasks}->{$_}->{autoscaling};
    next if !exists $config->{tasks}->{$_}->{autoscaling}->{scheduled};
    push @scheduled_action_names, keys %{ $config->{tasks}->{$_}->{autoscaling}->{scheduled} };
  }

  return @scheduled_action_names;
}

########################################################################
sub update_config_id {
########################################################################
  my ($self) = @_;

  $Data::Dumper::Sortkeys = $TRUE;

  my $config = $self->get_config;

  delete $config->{id};
  delete $config->{last_updated};

  my $md5_hex = md5_hex( Dumper( $self->get_config ) );

  $config->{id} = $md5_hex;

  $config->{last_updated} = scalar localtime;

  return $config;
}

########################################################################
sub update_config {
########################################################################
  my ($self) = @_;

  $self->log_warn( 'builder: config file %s %s be updated', $self->get_config_name, $self->get_update ? 'will' : 'will not' );

  return
    if !$self->get_update;

  my ( $fh, $filename ) = tempfile( 'fargate-stack-XXXX', SUFFIX => '.yml' );

lib/App/FargateStack/Builder/Events.pm  view on Meta::CPAN

    params  => [ ( $policy ? 'update' : 'create' ), $policy_name, $role_name ]
  );

  $self->log_warn( 'iam:role-policy: policy [%s] %s successfully for [%s]...',
    $policy_name, ( $policy ? 'updated' : 'created' ), $role_name );

  return;
}

########################################################################
sub update_rule_state {
########################################################################
  my ( $self, $state ) = @_;

  my ( $config, $tasks, $dryrun ) = $self->common_args(qw(config tasks dryrun));

  my ($task_name) = $self->get_args;

  my $err;

  if ( !$task_name ) {

lib/App/FargateStack/Builder/WafV2.pm  view on Meta::CPAN

sub web_acl_diffs {
########################################################################
  my ( $self, $web_acl ) = @_;

  my $current_web_acl = slurp_file( 'web-acl.json', $TRUE );

  return $self->display_diffs( $current_web_acl, $web_acl );
}

########################################################################
sub update_web_acl {
########################################################################
  my ( $self, $lock_token ) = @_;

  my $web_acl = $self->fetch_web_acl;

  my ( $id, $visibility_config, $rules, $description, $default_action )
    = @{ $web_acl->{WebACL} }{qw(Id VisibilityConfig Rules Description DefaultAction)};

  my $scope = 'REGIONAL';

lib/App/WafV2.pm  view on Meta::CPAN

      '--name'  => $name,
      '--id'    => $id,
      '--scope' => $scope,
      $query ? ( '--query' => $query ) : ()
    ]
  );

}

########################################################################
sub update_regex_pattern_set {
########################################################################
  my ( $self, %args ) = @_;

  my ( $name, $id, $query, $patterns, $description, $scope ) = @args{qw(name id query patterns description scope)};

  $scope //= $self->get_scope // 'REGIONAL';

  die "usage: update_regex_pattern_set(name => name, scope => scope, id => id, patterns => patterns);\n"
    if !( $name && $scope && $id && $patterns );

lib/App/WafV2.pm  view on Meta::CPAN

      '--default-action'    => $default_action,
      '--visibility-config' => $visibility_config,
      '--description'       => $description,
      '--rules'             => sprintf( 'file://%s', $rules_file ),
    ]
  );
}

# TBD: refactor to use guts of create_web_acl
########################################################################
sub update_web_acl {
########################################################################
  my ( $self, %args ) = @_;

  my ( $id, $scope, $name, $rules, $default_action, $visibility_config, $description, $lock_token, $query, $metric_name )
    = @args{qw(id scope name rules default_action visibility_config description lock_token query metric_name)};

  $scope          //= 'REGIONAL';
  $default_action //= 'Allow={}';

  my $rules_file = check_rules($rules);



( run in 0.227 second using v1.01-cache-2.11-cpan-47059a37de6 )