Sha256: 2272cb0f08db36e52adb12c00d3cfa296d1ce24e8a409171e865a3a82ced3456

Contents?: true

Size: 1.79 KB

Versions: 13

Compression:

Stored size: 1.79 KB

Contents

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


require "google/cloud/spanner/database/backup_info"

module Google
  module Cloud
    module Spanner
      class Database
        class RestoreInfo
          ##
          # @private Creates a new Database::RestoreInfo instance.
          def initialize grpc
            @grpc = grpc
          end

          ##
          # The database restored from source type `:BACKUP`.
          # @return [Symbol]
          def source_type
            @grpc.source_type
          end

          ##
          # Database restored from backup.
          #
          # @return [Boolean]
          def source_backup?
            @grpc.source_type == :BACKUP
          end

          # Information about the backup used to restore the database.
          # The backup may no longer exist.
          #
          # @return [Google::Cloud::Spanner::Database::BackupInfo, nil]
          def backup_info
            return nil unless @grpc.backup_info
            BackupInfo.from_grpc @grpc.backup_info
          end

          ##
          # @private Creates a new Database::RestoreInfo instance from a
          # `Google::Cloud::Spanner::Admin::Database::V1::RestoreInfo`
          def self.from_grpc grpc
            new grpc
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
google-cloud-spanner-2.10.1 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.10.0 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.9.0 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.8.1 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.8.0 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.7.0 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.6.0 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.5.0 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.4.0 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.3.0 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.2.0 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.1.0 lib/google/cloud/spanner/database/restore_info.rb
google-cloud-spanner-2.0.0 lib/google/cloud/spanner/database/restore_info.rb