Sha256: b9399b4414c95daf79c0a0ca86723fd2db67272b4afd839ddeaef3f14145f1b4

Contents?: true

Size: 1.4 KB

Versions: 56

Compression:

Stored size: 1.4 KB

Contents

require 'fog/core/model'

module Fog
  module Network
    class OpenStack
      class Network < Fog::Model
        identity :id

        attribute :name
        attribute :subnets
        attribute :shared
        attribute :status
        attribute :admin_state_up
        attribute :tenant_id
        attribute :provider_network_type,       
                  :aliases =>  'provider:network_type'
        attribute :provider_physical_network,
                  :aliases => 'provider:physical_network'
        attribute :provider_segmentation_id,
                  :aliases => 'provider:segmentation_id'
        attribute :router_external,
                  :aliases => 'router:external'

        def initialize(attributes)
          # Old 'connection' is renamed as service and should be used instead
          prepare_service_value(attributes)
          super
        end

        def save
          identity ? update : create
        end

        def create
          merge_attributes(service.create_network(self.attributes).body['network'])
          self
        end

        def update
          requires :id
          merge_attributes(service.update_network(self.id,
                                                     self.attributes).body['network'])
          self
        end

        def destroy
          requires :id
          service.delete_network(self.id)
          true
        end

      end
    end
  end
end

Version data entries

56 entries across 56 versions & 6 rubygems

Version Path
fog-maestrodev-1.19.0.20140212012611 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/openstack/models/network/network.rb
fog-1.19.0 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/openstack/models/network/network.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/openstack/models/network/network.rb