# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2020 Raritan Inc. All rights reserved.
#
# This file was generated by IdlC from CascadeManager.idl.

use strict;

package Raritan::RPC::cascading::CascadeManager;

use parent qw(Raritan::RPC::RemoteObject);

use constant typeId => "cascading.CascadeManager:1.0.0";

sub new {
    my ($class, $agent, $rid, $typeId) = @_;
    $typeId = $typeId || Raritan::RPC::cascading::CascadeManager::typeId;
    return $class->SUPER::new($agent, $rid, $typeId);
}

use constant NO_ERROR => 0;

use constant ERR_INVALID_PARAM => 1;

use constant ERR_UNSUPPORTED_ON_MASTER => 2;

use constant ERR_UNSUPPORTED_ON_LINK_UNIT => 3;

use constant ERR_LINK_ID_IN_USE => 4;

use constant ERR_HOST_IN_USE => 5;

use constant ERR_LINK_UNIT_UNREACHABLE => 6;

use constant ERR_LINK_UNIT_ACCESS_DENIED => 7;

use constant ERR_LINK_UNIT_REFUSED => 8;

use constant ERR_UNIT_BUSY => 9;

use constant ERR_NOT_SUPPORTED => 10;

use constant ERR_PASSWORD_CHANGE_REQUIRED => 11;

use constant ERR_PASSWORD_POLICY => 12;

use Raritan::RPC::cascading::CascadeManager::Status;

sub getStatus($) {
    my ($self) = @_;
    my $agent = $self->{'agent'};
    my $args = {};
    my $rsp = $agent->json_rpc($self->{'rid'}, 'getStatus', $args);
    my $_ret_;
    $_ret_ = Raritan::RPC::cascading::CascadeManager::Status::decode($agent, $rsp->{'_ret_'});
    return $_ret_;
}

sub addLinkUnit($$$$$$) {
    my ($self, $linkId, $host, $login, $password, $newPassword) = @_;
    my $agent = $self->{'agent'};
    my $args = {};
    $args->{'linkId'} = 1 * $linkId;
    $args->{'host'} = "$host";
    $args->{'login'} = "$login";
    $args->{'password'} = "$password";
    $args->{'newPassword'} = "$newPassword";
    my $rsp = $agent->json_rpc($self->{'rid'}, 'addLinkUnit', $args);
    my $_ret_;
    $_ret_ = $rsp->{'_ret_'};
    return $_ret_;
}

sub releaseLinkUnit($$) {
    my ($self, $linkId) = @_;
    my $agent = $self->{'agent'};
    my $args = {};
    $args->{'linkId'} = 1 * $linkId;
    my $rsp = $agent->json_rpc($self->{'rid'}, 'releaseLinkUnit', $args);
    my $_ret_;
    $_ret_ = $rsp->{'_ret_'};
    return $_ret_;
}

sub requestLink($$) {
    my ($self, $token) = @_;
    my $agent = $self->{'agent'};
    my $args = {};
    $args->{'token'} = "$token";
    my $rsp = $agent->json_rpc($self->{'rid'}, 'requestLink', $args);
    my $_ret_;
    $_ret_ = $rsp->{'_ret_'};
    return $_ret_;
}

sub finalizeLink($$) {
    my ($self, $token) = @_;
    my $agent = $self->{'agent'};
    my $args = {};
    $args->{'token'} = "$token";
    my $rsp = $agent->json_rpc($self->{'rid'}, 'finalizeLink', $args);
}

sub unlink($) {
    my ($self) = @_;
    my $agent = $self->{'agent'};
    my $args = {};
    my $rsp = $agent->json_rpc($self->{'rid'}, 'unlink', $args);
}

Raritan::RPC::Registry::registerProxyClass('cascading.CascadeManager', 1, 0, 0, 'Raritan::RPC::cascading::CascadeManager');
1;
