Sha256: f2a071221f4cba520fb1e27aeb1fb1963faa4db7ed91b2763f71d22d4cb2c27b

Contents?: true

Size: 1.6 KB

Versions: 20

Compression:

Stored size: 1.6 KB

Contents

module Fog
  module Google
    class SQL
      ##
      # Exports data from a Cloud SQL instance to a Google Cloud Storage
      # bucket as a MySQL dump or CSV file.
      #
      # @see https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/export
      class Real
        def export_instance(instance_id, uri,
                            databases: [],
                            sql_export_options: {},
                            csv_export_options: {},
                            file_type: nil)
          data = {
            :kind => "sql#exportContext",
            :uri => uri,
            :databases => databases
          }

          unless file_type.nil?
            data[:file_type] = file_type
          end

          unless csv_export_options.empty?
            data[:csv_export_options] =
              ::Google::Apis::SqladminV1beta4::ExportContext::CsvExportOptions.new(csv_export_options)
          end

          unless sql_export_options.nil?
            data[:sql_export_options] =
              ::Google::Apis::SqladminV1beta4::ExportContext::SqlExportOptions.new(sql_export_options)
          end

          export_context = ::Google::Apis::SqladminV1beta4::ExportContext.new(export_context)
          @sql.export_instance(
            @project,
            instance_id,
            ::Google::Apis::SqladminV1beta4::ExportInstancesRequest.new(
              :export_context => export_context
            )
          )
        end
      end

      class Mock
        def export_instance(_instance_id, _uri, _options: {})
          Fog::Mock.not_implemented
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
fog-google-1.9.1 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.9.0 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.8.2 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.8.1 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.8.0 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.7.1 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.7.0 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.6.0 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.5.0 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.4.0 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.3.3 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.3.2 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.3.1 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.3.0 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.2.2 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.2.1 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.2.0 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.1.0 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.0.1 lib/fog/google/requests/sql/export_instance.rb
fog-google-1.0.0 lib/fog/google/requests/sql/export_instance.rb