Sha256: bb3f794370b0229ae03885e7d235c189b9b0ecc8a70c39bc469a739ba6088acb

Contents?: true

Size: 1.49 KB

Versions: 4

Compression:

Stored size: 1.49 KB

Contents

require 'fog/compute/gridscale/models/storage'

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

        attribute :name
        attribute :object_uuid
        attribute :location_uuid
        attribute :labels
        attribute :status
        attribute :create_time
        attribute :change_time
        attribute :location_name
        attribute :location_country
        attribute :location_iata
        attribute :relations

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

        def destroy
          requires :object_uuid
          response = service.paas_security_zone_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

          options = {}

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



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

          data = service.paas_security_zone_create(name, options)

          merge_attributes(data.body)
          true
        end

        def update
          requires :object_uuid
          data = service.paas_security_zone_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_security_zone.rb
fog-gridscale-0.1.4 lib/fog/compute/gridscale/models/paas_security_zone.rb
fog-gridscale-0.1.3 lib/fog/compute/gridscale/models/paas_security_zone.rb
fog-gridscale-0.1.2 lib/fog/compute/gridscale/models/paas_security_zone.rb