Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104830568
PhutilAWSS3GetManagementWorkflow.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Mar 12, 17:51
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Mar 14, 17:51 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24862224
Attached To
rPHU libphutil
PhutilAWSS3GetManagementWorkflow.php
View Options
<?php
final
class
PhutilAWSS3GetManagementWorkflow
extends
PhutilAWSS3ManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'get'
)
->
setExamples
(
'**get** --key __key__'
)
->
setSynopsis
(
pht
(
'Download content from S3.'
))
->
setArguments
(
array_merge
(
$this
->
getAWSArguments
(),
$this
->
getAWSS3BucketArguments
(),
array
(
array
(
'name'
=>
'key'
,
'param'
=>
'key'
,
'help'
=>
pht
(
'Specify a key to retrieve.'
),
),
)));
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$bucket
=
$args
->
getArg
(
'bucket'
);
if
(!
strlen
(
$bucket
))
{
throw
new
PhutilArgumentUsageException
(
pht
(
'Specify an AWS S3 bucket to access with --bucket.'
));
}
$endpoint
=
$args
->
getArg
(
'endpoint'
);
if
(!
strlen
(
$endpoint
))
{
throw
new
PhutilArgumentUsageException
(
pht
(
'Specify an AWS S3 endpoint with --endpoint.'
));
}
$key
=
$args
->
getArg
(
'key'
);
if
(!
strlen
(
$key
))
{
throw
new
PhutilArgumentUsageException
(
pht
(
'Specify an AWS S3 object key to access with --key.'
));
}
$future
=
$this
->
newAWSFuture
(
new
PhutilAWSS3Future
())
->
setBucket
(
$bucket
)
->
setEndpoint
(
$endpoint
)
->
setParametersForGetObject
(
$key
);
echo
$future
->
resolve
();
return
0
;
}
}
Event Timeline
Log In to Comment