NAME

Webservice::OVH::Cloud::Project::Instance

SYNOPSIS

    use Webservice::OVH;
    
    my $ovh = Webservice::OVH->new_from_json("credentials.json");
    
    my $projects = $ovh->cloud->projects;
    my $example_project = $projects->[0];
    
    my $instances = $project->instances;
    
    foreach my $instance (@$instances) {
        
        print @$instance->status;
        $instance->delete;
    }

DESCRIPTION

Access to instace functionality.

METHODS

_new_empty

Internal Method to create the Network object. This method is not ment to be called directly. This method is used when instance is initialised as a bridge object for static usage.

  • Parameter: %params - key => value

  • Return: Webservice::OVH::Cloud::Project::Instance

  • Synopsis: Webservice::OVH::Cloud::Project::Instance->_new(wrapper => $ovh_api_wrapper, project => $project, module => $module );

group_exists

Returns 1 if object is available, 0 if not.

  • Parameter: $group_id - api id, $no_recheck - (optional)only for internal usage

  • Return: VALUE

  • Synopsis: print "group exists" if $project->group_exists($id);

groups

Produces an array of all available groups that are connected to the instance.

  • Return: ARRAY

  • Synopsis: my $instances = $instance->groups;

group

Returns a single group by id

create_group

Creates a new group

  • Parameter: %params - key => value (required) region

  • Return: <Webservice::OVH::Cloud::Project::Instance::Group>

  • Synopsis: my $group = $project->create_instance( region => 'GRA1' );

_new_existing

Internal Method to create the Instance object. This method is not ment to be called directly.

  • Parameter: %params - key => value

  • Return: Webservice::OVH::Cloud::Project::Instance

  • Synopsis: Webservice::OVH::Cloud::Project::Instance->_new( wrapper => $ovh_api_wrapper, project => $project, module => $module, id => $id );

_new

Internal Method to create the Instance object. This method is not ment to be called directly.

  • Parameter: %params - key => value

  • Return: Webservice::OVH::Cloud::Project::Instance

  • Synopsis: Webservice::OVH::Cloud::Project::Instance->_new(wrapper => $ovh_api_wrapper, project => $project, module => $module );

id

Returns the api id

  • Return: VALUE

  • Synopsis: my $id = $instance->id;

is_valid

When this object is deleted on the api side, this method returns 0.

  • Return: VALUE

  • Synopsis: print "Valid" if $instance->is_valid;

_is_valid

Internal method to check validity. Difference is that this method carps an error.

  • Return: VALUE

  • Synopsis: $instance->_is_valid;

project

Root Project.

properties

Returns the raw properties as a hash. This is the original return value of the web-api.

  • Return: HASH

  • Synopsis: my $properties = $instance->properties;

description

Exposed property value.

  • Return: VALUE

  • Synopsis: my $description = $instance->description;

status

Exposed property value.

  • Return: VALUE

  • Synopsis: my $status = $instance->status;

name

Exposed property value.

  • Return: VALUE

  • Synopsis: my $name = $instance->name;

region

Exposed property value.

  • Return: VALUE

  • Synopsis: my $region = $instance->region;

image

Exposed property value.

  • Return: <Webservice::OVH::Cloud::Project::Image>

  • Synopsis: my $image = $instance->image;

created

Exposed property value.

  • Return: DateTime

  • Synopsis: my $dt_created = $instance->created;

ssh_key

Exposed property value.

  • Return: <Webservice::OVH::Cloud::Project::SSH>

  • Synopsis: my $ssh_key = $instance->ssh_key;

monthly_billing

Exposed property value.

  • Return: HASH

  • Synopsis: my $monthly_billing = $instance->monthly_billing;

ip_addresses

Exposed property value.

  • Return: ARRAY

  • Synopsis: my $ip_addresses = $instance->ip_addresses;

flavor

Exposed property value.

  • Return: HASH

  • Synopsis: my $flavor = $instance->flavor;

change

Changes the instance.

  • Parameter: $instance_name - instance name

  • Synopsis: $instance->change('Test Instance');

delete

Deletes the object api sided and sets it invalid.

  • Synopsis: $instance->delete;

delete

Activates monthly billing for rinstance.

  • Synopsis: $instance->active_monthly_billing;

delete

Return many statistics about the virtual machine for a given period

  • Return: HASH

  • Synopsis: $instance->monitoring;

reboot

Reboots the instance. Options are soft or hard.

  • Parameter: $type - soft hard

  • Synopsis: $instance->reboot;

reinstall

Reinstall an instance.

  • Parameter: $image_id - image id

  • Synopsis: $instance->reboot;

rescue_mode

Enable or disable rescue mode.

  • Parameter: $rescue - enabled or not (true/1), (optional) $image_id - image id

  • Synopsis: $instance->reboot;

resize

Migrate your instance to another flavor.

  • Parameter: $rescue - enabled or not (true/1), (optional) $image_id - image id

  • Synopsis: $instance->resize($flavor_id);

snapshot

Snapshot an instance.

  • Parameter: $snapshotName - Name of the snapshot

  • Synopsis: $instance->snapshotName("Snapshot1");

vnc

Get VNC access to your instance.

  • Synopsis: $instance->vnc;