Giter VIP home page Giter VIP logo

net-openstack-compute's Introduction

NAME

Net::OpenStack::Compute - Bindings for the OpenStack Compute API.

VERSION

version 1.1200

SYNOPSIS

use Net::OpenStack::Compute;
my $compute = Net::OpenStack::Compute->new(
    auth_url     => 'https://identity.api.rackspacecloud.com/v2.0',
    user         => 'alejandro',
    password     => 'password',
    region       => 'ORD',
);
$compute->create_server({
    name      => 'server1',
    flavorRef => $flav_id,
    imageRef  => $img_id,
});

DESCRIPTION

This class is an interface to the OpenStack Compute API. Also see the oscompute command line tool.

METHODS

Methods that take a hashref data param generally expect the corresponding data format as defined by the OpenStack API JSON request objects. See the OpenStack Docs for more information. Methods that return a single resource will return false if the resource is not found. Methods that return an arrayref of resources will return an empty arrayref if the list is empty. Methods that create, modify, or delete resources will throw an exception on failure.

new

Creates a client.

params:

  • auth_url

    Required. The url of the authentication endpoint. For example: 'https://identity.api.rackspacecloud.com/v2.0'

  • user

    Required.

  • password

    Required.

  • region

    Optional.

  • project_id

    Optional.

  • service_name

    Optional.

  • verify_ssl

    Optional. Defaults to 1.

  • is_rax_auth

    Optional. Defaults to 0.

get_server

get_server($id)

Returns the server with the given id or false if it doesn't exist.

get_servers

get_servers(%params)

params:

  • detail

    Optional. Defaults to 0.

  • query

    Optional query string to be appended to requests.

Returns an arrayref of all the servers.

get_servers_by_name

get_servers_by_name($name)

Returns an arrayref of servers with the given name. Returns an empty arrayref if there are no such servers.

create_server

create_server({ name => $name, flavorRef => $flavor, imageRef => $img_id })

Returns a server hashref.

delete_server

delete_server($id)

Returns true on success.

rebuild_server

rebuild_server($server_id, { imageRef => $img_id })

Returns a server hashref.

set_password

set_password($server_id, $new_password)

Returns true on success.

get_vnc_console

get_vnc_console($server_id[, $type=novnc])

Returns a url to the server's VNC console

get_networks

get_networks($id)

Returns a network list . =head2 get_image

get_image($id)

Returns an image hashref.

get_images

get_images(%params)

params:

  • detail

    Optional. Defaults to 0.

  • query

    Optional query string to be appended to requests.

Returns an arrayref of all the images.

create_image

create_image($server_id, { name => 'bob' })

Returns an image hashref.

delete_image

delete_image($id)

Returns true on success.

get_flavor

get_flavor($id)

Returns a flavor hashref.

get_flavors

get_flavors(%params)

params:

  • detail

    Optional. Defaults to 0.

  • query

    Optional query string to be appended to requests.

Returns an arrayref of all the flavors.

token

token()

Returns the OpenStack Compute API auth token.

base_url

base_url()

Returns the base url for the OpenStack Compute API, which is returned by the server after authenticating.

SEE ALSO

AUTHOR

Naveed Massjouni [email protected]

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Naveed Massjouni.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

net-openstack-compute's People

Contributors

bmwiedemann avatar exzz avatar ironcamel avatar leto avatar trefzer avatar vincent-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

net-openstack-compute's Issues

dzil test fails

$ dzil test
[DZ] building test distribution under .build/VYaHu0JnRR
[DZ] beginning to build Net-OpenStack-Compute
[DZ] guessing dist's main_module is lib/Net/OpenStack/Compute.pm
[OurPkgVersion] Skipping: "bin/oscompute" has no "# VERSION" comment
[OurPkgVersion] Skipping: "lib/Net/OpenStack/Compute/AuthRole.pm" has no "# VERSION" comment
[DZ] extracting distribution abstract from lib/Net/OpenStack/Compute.pm
couldn't find package declaration in bin/oscompute at /home/leto/local-lib/lib/perl5/Pod/Weaver.pm line 73
$ modversion Dist::Zilla
4.300016

Error when creating new compute object.

I'm quite new to using Openstack and Perl.
I've successfully installed Net::OpenStack::Compute module on my openstack server.
Command line tool oscompute is also running successfully.
All the commands of oscompute tool are displaying correct results.

But when I created a simple perl program to use the above module, it gives me error as below.

401 Unauthorized

{"error": {"message": "Could not find project, 2e62f0d0dfd945e7b809ce79d54df887.", "code": 401, "title": "Unauthorized"}} at /usr/local/share/perl5/Net/OpenStack/Compute/AuthRole.pm line 72.

The perl file content is as below:

use Net::OpenStack::Compute;

my $compute = Net::OpenStack::Compute -> new(
auth_url => "http://192.168.1.48:5000/v2.0",
user => "admin",
password => "password",
project_id => "2e62f0d0dfd945e7b809ce79d54df887",

);

I have already checked that project Id that I have entered in the file is correct and that project is accessible through OpenStack Web GUI.

Let me know if there are any other pre-requisites that needs to be fulfilled.

Support Identity v3

Hi!

Since the release of Openstack Havana the preferred version of Identity to use is v3. Some cloud providers have now migrated to only supporting v3 for token generation to get support for domains.

Currently Net::OpenStack::Compute does not work with providers that require support for Identity v3.

Would it be possible to add support for Identity v3 in this project as well?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.