GCloud::CLIWrapper - Module to use Google Cloud APIs via the gcloud CLI
use GCloud::CLIWrapper; my $api = GCloud::CLIWrapper->new(); my $result = $api->run('info'); # $result->success == 1 if the command executed correctly # $result->output contains the output of the command my $result = $api->json('info', '--format', 'json'); # $result->success == 1 if the command executed correctly # $result->output contains the output of the command # $result->json is a hashref with the result of the parsed JSON output of the command
This module helps you use the GCloud API. It sends all it's commands via the CLI command line tool gcloud.
gcloud
By default initialized to gcloud. It will try to find kubectl in the PATH. You can set it explicitly to a specific gcloud excecutable.
An ArrayRef of options to always add to the command line invocations.
my $api = GCloud::CLIWrapper->new( gcloud_options => [ 'info' ], ); my $result = $api->run; # $result->success == 1 if the command executed correctly # $result->output contains the output of the command my $result = $api->json('--format', 'json'); # $result->success == 1 if the command executed correctly # $result->output contains the output of the command # $result->json is a hashref with the result of the parsed JSON output of the command
Will run gcloud with the parameters. Returns a GCloud::CLIWrapper::Result object with output set to the output of the command, and success a Boolean to indicate if the command reported successful execution.
output
success
Will run gcloud with the parameters, trying to parse the output as json. Note that you are responsible for passing the command-line option to output in a json format. Returns a Kubectl::CLIWrapper::Result object with output set to the output of the command, and json set to a hashref with the parsed JSON. success will be false if JSON parsing fails.
json
https://cloud.google.com/sdk/gcloud/
Jose Luis Martinez CAPSiDE jlmartinez@capside.com
The source code is located here: L<>
Please report bugs to: L<>
Copyright (c) 2018 by CAPSiDE This code is distributed under the Apache 2 License. The full text of the license can be found in the LICENSE file included with this module.
2 POD Errors
The following errors were encountered while parsing the POD:
An empty L<>
To install GCloud::CLIWrapper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GCloud::CLIWrapper
CPAN shell
perl -MCPAN -e shell install GCloud::CLIWrapper
For more information on module installation, please visit the detailed CPAN module installation guide.