项目作者: pplu

项目描述 :
Module to use Google Cloud APIs from Perl via the gcloud CLI
高级语言: Perl
项目地址: git://github.com/pplu/GCloud-CLIWrapper.git
创建时间: 2018-08-03T09:30:45Z
项目社区:https://github.com/pplu/GCloud-CLIWrapper

开源协议:

下载


NAME

GCloud::CLIWrapper - Module to use Google Cloud APIs via the gcloud CLI

SYNOPSIS

  1. use GCloud::CLIWrapper;
  2. my $api = GCloud::CLIWrapper->new();
  3. my $result = $api->run('info');
  4. # $result->success == 1 if the command executed correctly
  5. # $result->output contains the output of the command
  6. my $result = $api->json('info', '--format', 'json');
  7. # $result->success == 1 if the command executed correctly
  8. # $result->output contains the output of the command
  9. # $result->json is a hashref with the result of the parsed JSON output of the command

DESCRIPTION

This module helps you use the GCloud API. It sends all it’s commands
via the CLI command line tool gcloud.

ATTRIBUTES

glcloud

By default initialized to gcloud. It will try to find kubectl in the PATH. You can
set it explicitly to a specific gcloud excecutable.

gcloud_options

An ArrayRef of options to always add to the command line invocations.

  1. my $api = GCloud::CLIWrapper->new(
  2. gcloud_options => [ 'info' ],
  3. );
  4. my $result = $api->run;
  5. # $result->success == 1 if the command executed correctly
  6. # $result->output contains the output of the command
  7. my $result = $api->json('--format', 'json');
  8. # $result->success == 1 if the command executed correctly
  9. # $result->output contains the output of the command
  10. # $result->json is a hashref with the result of the parsed JSON output of the command

METHODS

run(@parameters)

Will run gcloud with the parameters. Returns a :Result">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.

json(@parameters)

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 :Result">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.

SEE ALSO

https://cloud.google.com/sdk/gcloud/

AUTHOR

  1. Jose Luis Martinez
  2. CAPSiDE
  3. jlmartinez@capside.com

BUGS and SOURCE

The source code is located here: https://github.com/pplu/GCloud-CLIWrapper.git

Please report bugs to: https://github.com/pplu/GCloud-CLIWrapper/issues

COPYRIGHT and LICENSE

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.