Google-Cloud-Dataproc-V1

 view release on metacpan or  search on metacpan

lib/Google/Cloud/Dataproc/V1/SessionTemplates.pm  view on Meta::CPAN


# === Service Client: Google::Cloud::Dataproc::V1::SessionTemplates::SessionTemplateControllerClient ===
package Google::Cloud::Dataproc::V1::SessionTemplates::SessionTemplateControllerClient;

=pod

=head1 NAME

Google::Cloud::Dataproc::V1::SessionTemplates::SessionTemplateControllerClient - Client stub representing the remote SessionTemplateController service

=head1 DESCRIPTION

This class acts as a local client stub for the remote gRPC service.
It delegates call dispatching to an underlying L<Google::gRPC::Client>
instance, ensuring type-safe request parsing and response mapping.

=head1 CONFIGURATION AND ENVIRONMENT

=head2 target

The endpoint target address. Defaults to C<dataproc.googleapis.com:443>.

=head2 credentials

The authentication credentials provider. Defaults to application default credentials via L<Google::Auth>.

=cut

use Moo;
use Google::Auth;
use Google::gRPC::Client;

has credentials => ( is => 'ro', default => sub { Google::Auth->default() } );
has target      => ( is => 'ro', default => 'dataproc.googleapis.com:443' );

has _grpc_client => (
    is => 'ro',
    lazy => 1,
    builder => sub {
        my $self = shift;
        return Google::gRPC::Client->new(
            target     => $self->target,
            auth_token => $self->credentials->get_token(),
        );
    }
);

sub create_session_template {
    my ($self, $args) = @_;
    my $req = ref($args) eq 'HASH'
        ? Google::Cloud::Dataproc::V1::SessionTemplates::CreateSessionTemplateRequest->new($args)
        : $args;
    return $self->_grpc_client->call({
        service        => 'google.cloud.dataproc.v1.SessionTemplateController',
        method         => 'CreateSessionTemplate',
        request        => $req,
        response_class => 'Google::Cloud::Dataproc::V1::SessionTemplates::SessionTemplate',
    });
}

sub update_session_template {
    my ($self, $args) = @_;
    my $req = ref($args) eq 'HASH'
        ? Google::Cloud::Dataproc::V1::SessionTemplates::UpdateSessionTemplateRequest->new($args)
        : $args;
    return $self->_grpc_client->call({
        service        => 'google.cloud.dataproc.v1.SessionTemplateController',
        method         => 'UpdateSessionTemplate',
        request        => $req,
        response_class => 'Google::Cloud::Dataproc::V1::SessionTemplates::SessionTemplate',
    });
}

sub get_session_template {
    my ($self, $args) = @_;
    my $req = ref($args) eq 'HASH'
        ? Google::Cloud::Dataproc::V1::SessionTemplates::GetSessionTemplateRequest->new($args)
        : $args;
    return $self->_grpc_client->call({
        service        => 'google.cloud.dataproc.v1.SessionTemplateController',
        method         => 'GetSessionTemplate',
        request        => $req,
        response_class => 'Google::Cloud::Dataproc::V1::SessionTemplates::SessionTemplate',
    });
}

sub list_session_templates {
    my ($self, $args) = @_;
    my $req = ref($args) eq 'HASH'
        ? Google::Cloud::Dataproc::V1::SessionTemplates::ListSessionTemplatesRequest->new($args)
        : $args;
    return $self->_grpc_client->call({
        service        => 'google.cloud.dataproc.v1.SessionTemplateController',
        method         => 'ListSessionTemplates',
        request        => $req,
        response_class => 'Google::Cloud::Dataproc::V1::SessionTemplates::ListSessionTemplatesResponse',
    });
}

sub delete_session_template {
    my ($self, $args) = @_;
    my $req = ref($args) eq 'HASH'
        ? Google::Cloud::Dataproc::V1::SessionTemplates::DeleteSessionTemplateRequest->new($args)
        : $args;
    return $self->_grpc_client->call({
        service        => 'google.cloud.dataproc.v1.SessionTemplateController',
        method         => 'DeleteSessionTemplate',
        request        => $req,
        response_class => 'Google::Protobuf::Empty::Empty',
    });
}

1;

__END__

=head1 NAME

Google::Cloud::Dataproc::V1::SessionTemplates - Protocol Buffers schema definition

=head1 DESCRIPTION



( run in 1.350 second using v1.01-cache-2.11-cpan-7e94247ccb0 )