Amazon-S3

 view release on metacpan or  search on metacpan

lib/Amazon/S3/CLI.pm  view on Meta::CPAN

    format => 'text',
  );

  my @option_specs = qw(
    availability-zone=s
    bucket-name|b=s
    content-type=s
    debug
    dns-bucket-names
    endpoint-url|u=s
    force|f
    format|F=s
    help|h
    host|H=s
    key|k=s
    modified-since|m=s
    output|o=s
    prefix=s
    profile|p=s
    range|R=s
    region|r=s
    secure|s
    version-id=s
  );

  my %commands = (
    'add-key'                  => \&cmd_add_key,
    'copy-key'                 => \&cmd_copy_key,
    'create-bucket'            => \&cmd_create_bucket,
    'delete-key'               => \&cmd_delete_key,
    'empty-bucket'             => \&cmd_empty_bucket,
    'get-key'                  => \&cmd_get_key,
    'get-bucket-policy'        => \&cmd_get_bucket_policy,
    'get-bucket-acl'           => \&cmd_get_bucket_acl,
    'get-bucket-policy-status' => \&cmd_get_bucket_policy_status,
    'list-bucket-keys'         => \&cmd_list_bucket_keys,
    'list-directory-buckets'   => \&cmd_list_directory_buckets,
    'list-keys'                => 'list-bucket-keys',
    'list-object-versions'     => \&cmd_list_object_versions,
    'remove-bucket'            => \&cmd_remove_bucket,
    'list-buckets'             => \&cmd_list_buckets,
  );

  return __PACKAGE__->new(
    commands        => \%commands,
    option_specs    => \@option_specs,
    default_options => \%default_options,
    abbreviations   => $TRUE,
    extra_options   => [qw(s3 secure ascii_table)],
  )->run;
}

1;

__END__

## no critic

=pod

=encoding utf8

=head1 NAME

Amazon::S3::CLI - command line interface for common S3 operations

=head1 SYNOPSIS

  # list buckets in tabular format
  amzn-s3-cli list-buckets --profile sandbox --format table

  # list keys in JSON format
  amzn-s3-cli list-keys test-bucket --format json

  # create a new bucket on LocalStack
  amzn-s3-cli create-bucket my-bucket --endpoint-url http://localhost:4566 --profile localstack

  # add a key using the filename as the object name
  amzn-s3-cli add-key --bucket-name my-bucket some-file

  # add a key with a different object name
  amzn-s3-cli add-key --bucket-name my-bucket some-file project-alpha/some-file

  # retrieve an object
  amzn-s3-cli get-key my-bucket project-alpha/some-file

  # delete an object
  amzn-s3-cli delete-key --bucket-name my-bucket some-file

  # inspect bucket configuration
  amzn-s3-cli get-bucket-policy --bucket-name my-bucket
  amzn-s3-cli get-bucket-policy-status --bucket-name my-bucket
  amzn-s3-cli get-bucket-acl --bucket-name my-bucket

=head1 USAGE

  usage: amzn-s3-cli [options] command [arguments]

Common commands:

  add-key                  Add an object
  copy-key                 Copy an object
  create-bucket            Create a bucket
  delete-key               Delete an object
  empty-bucket             Empty a bucket
  get-bucket-acl           Retrieve a bucket ACL
  get-bucket-policy        Retrieve a bucket policy
  get-bucket-policy-status Retrieve bucket policy status
  get-key                  Retrieve an object
  list-bucket-keys         List objects
  list-buckets             List buckets
  list-directory-buckets   List directory buckets
  list-object-versions     List object versions
  remove-bucket            Remove a bucket

Use:

  amzn-s3-cli --help

for command and option documentation.



( run in 0.723 second using v1.01-cache-2.11-cpan-234fa220139 )