Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102360854
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, Feb 19, 21:54
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Feb 21, 21:54 (2 d)
Engine
blob
Format
Raw Data
Handle
24273237
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