Google-Cloud-Sql-V1

 view release on metacpan or  search on metacpan

lib/Google/Cloud/Sql/V1/CloudSqlBackups.pm  view on Meta::CPAN

=item * C<FINAL> => 3

=back

=cut

# Enum: Backup::SqlBackupState
our $Backup_SQL_BACKUP_STATE_UNSPECIFIED = 0;
our $Backup_ENQUEUED = 1;
our $Backup_RUNNING = 2;
our $Backup_FAILED = 3;
our $Backup_SUCCESSFUL = 4;
our $Backup_DELETING = 5;
our $Backup_DELETION_FAILED = 6;

=pod

=head2 Enum: Backup::SqlBackupState

Values:

=over 4

=item * C<SQL_BACKUP_STATE_UNSPECIFIED> => 0

=item * C<ENQUEUED> => 1

=item * C<RUNNING> => 2

=item * C<FAILED> => 3

=item * C<SUCCESSFUL> => 4

=item * C<DELETING> => 5

=item * C<DELETION_FAILED> => 6

=back

=cut

# === Service Client: Google::Cloud::Sql::V1::CloudSqlBackups::SqlBackupsServiceClient ===
package Google::Cloud::Sql::V1::CloudSqlBackups::SqlBackupsServiceClient;

=pod

=head1 NAME

Google::Cloud::Sql::V1::CloudSqlBackups::SqlBackupsServiceClient - Client stub representing the remote SqlBackupsService 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<sql.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 => 'sql.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_backup {
    my ($self, $args) = @_;
    my $req = ref($args) eq 'HASH'
        ? Google::Cloud::Sql::V1::CloudSqlBackups::CreateBackupRequest->new($args)
        : $args;
    return $self->_grpc_client->call({
        service        => 'google.cloud.sql.v1.SqlBackupsService',
        method         => 'CreateBackup',
        request        => $req,
        response_class => 'Google::Cloud::Sql::V1::CloudSqlResources::Operation',
    });
}

sub get_backup {
    my ($self, $args) = @_;
    my $req = ref($args) eq 'HASH'
        ? Google::Cloud::Sql::V1::CloudSqlBackups::GetBackupRequest->new($args)
        : $args;
    return $self->_grpc_client->call({
        service        => 'google.cloud.sql.v1.SqlBackupsService',
        method         => 'GetBackup',
        request        => $req,
        response_class => 'Google::Cloud::Sql::V1::CloudSqlBackups::Backup',
    });
}

sub list_backups {
    my ($self, $args) = @_;
    my $req = ref($args) eq 'HASH'
        ? Google::Cloud::Sql::V1::CloudSqlBackups::ListBackupsRequest->new($args)
        : $args;
    return $self->_grpc_client->call({
        service        => 'google.cloud.sql.v1.SqlBackupsService',
        method         => 'ListBackups',



( run in 1.028 second using v1.01-cache-2.11-cpan-81fc1098f69 )