Sha256: 96c446115b9086e0639237181e4e6730592532fb5b23f8bf4c5f8213d83ba328

Contents?: true

Size: 1.53 KB

Versions: 4

Compression:

Stored size: 1.53 KB

Contents

require 'fog/compute/gridscale/models/paas_service'

module Fog
  module Compute
    class Gridscale
      class PaasService < Fog::Model
        identity :object_uuid

        attribute :name
        attribute :object_uuid
        attribute :labels
        attribute :status
        attribute :create_time
        attribute :change_time
        attribute :current_price
        attribute :listen_port
        attribute :security_zone_uuid
        attribute :paas_service_template_uuid
        attribute :usage_in_minutes
        attribute :parameters
        attribute :credential
        attribute :resource_limit

        def delete
          requires :object_uuid
          response = service.paas_service_delete object_uuid
          response.body
        end

        def destroy
          requires :object_uuid
          response = service.paas_service_delete object_uuid
          response.body
        end

        def save
          raise Fog::Errors::Error.new('Re-saving an existing object may create a duplicate') if persisted?
          requires :name, :paas_service_template_uuid

          options = {}

          if attributes[:labels]
            options[:labels] = labels
          end

          data = service.paas_service_create(name, paas_service_template_uuid, options)

          merge_attributes(data.body)
          true
        end

        def update
          requires :object_uuid
          data = service.paas_service_update(object_uuid)
          merge_attributes(data.body)
          true
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-gridscale-0.1.5 lib/fog/compute/gridscale/models/paas_service.rb
fog-gridscale-0.1.4 lib/fog/compute/gridscale/models/paas_service.rb
fog-gridscale-0.1.3 lib/fog/compute/gridscale/models/paas_service.rb
fog-gridscale-0.1.2 lib/fog/compute/gridscale/models/paas_service.rb