Sha256: 356114b1a2f2a3cacbb398cbf88408737ef4d22915b2fe608c1b2d578142eab5

Contents?: true

Size: 1.77 KB

Versions: 22

Compression:

Stored size: 1.77 KB

Contents

require 'fog/core/model'

module Fog
  module Google
    class SQL
      ##
      # An Operation resource contains information about database instance operations
      # such as create, delete, and restart
      #
      # @see https://developers.google.com/cloud-sql/docs/admin-api/v1beta3/operations
      class Operation < Fog::Model
        identity :operation

        attribute :end_time, :aliases => 'endTime'
        attribute :enqueued_time, :aliases => 'enqueuedTime'
        attribute :error
        attribute :export_context, :aliases => 'exportContext'
        attribute :import_context, :aliases => 'importContext'
        attribute :instance
        attribute :kind
        attribute :operation_type, :aliases => 'operationType'
        attribute :start_time, :aliases => 'startTime'
        attribute :state
        attribute :user_email_address, :aliases => 'userEmailAddress'

        DONE_STATE    = 'DONE'
        PENDING_STATE = 'PENDING'
        RUNNING_STATE = 'RUNNING'
        UNKNOWN_STATE = 'UNKNOWN'

        ##
        # Checks if the instance operation is pending
        #
        # @return [Boolean] True if the operation is pending; False otherwise
        def pending?
          self.state == PENDING_STATE
        end

        ##
        # Checks if the instance operation is done
        #
        # @return [Boolean] True if the operation is done; False otherwise
        def ready?
          self.state == DONE_STATE
        end

        ##
        # Reloads an instance operation
        #
        # @return [Fog::Google::SQL::Operation] Instance operation resource
        def reload
          requires :identity

          data = collection.get(self.instance, self.identity)
          merge_attributes(data.attributes)
          self
        end
      end
    end
  end
end

Version data entries

22 entries across 20 versions & 5 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-google-0.1.0/lib/fog/google/models/sql/operation.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-google-0.1.0/lib/fog/google/models/sql/operation.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-google-0.1.0/lib/fog/google/models/sql/operation.rb
fog-google-0.1.3 lib/fog/google/models/sql/operation.rb
fog-google-0.1.2 lib/fog/google/models/sql/operation.rb
fog-google-0.1.1 lib/fog/google/models/sql/operation.rb
fog-google-0.1.0 lib/fog/google/models/sql/operation.rb
fog-google-0.0.9 lib/fog/google/models/sql/operation.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-google-0.0.7/lib/fog/google/models/sql/operation.rb
fog-google-0.0.7 lib/fog/google/models/sql/operation.rb
fog-google-0.0.6 lib/fog/google/models/sql/operation.rb
fog-google-0.0.5 lib/fog/google/models/sql/operation.rb
fog-google-0.0.4 lib/fog/google/models/sql/operation.rb
fog-google-0.0.3 lib/fog/google/models/sql/operation.rb
fog-google-0.0.2 lib/fog/google/models/sql/operation.rb
fog-1.29.0 lib/fog/google/models/sql/operation.rb
fog-1.28.0 lib/fog/google/models/sql/operation.rb
fog-1.27.0 lib/fog/google/models/sql/operation.rb
fog-1.26.0 lib/fog/google/models/sql/operation.rb
fog-1.25.0 lib/fog/google/models/sql/operation.rb