Sha256: f5a6f8028397b0f8ffa55d2528bb46181d427d74e8b0320c42869cdff0229da2

Contents?: true

Size: 1.65 KB

Versions: 13

Compression:

Stored size: 1.65 KB

Contents

module Fog
  module Compute
    class Google
      ##
      # Represents a Route resource
      #
      # @see https://developers.google.com/compute/docs/reference/latest/routes
      class Route < Fog::Model
        identity :name

        attribute :kind
        attribute :id
        attribute :creation_timestamp, :aliases => "creationTimestamp"
        attribute :description
        attribute :dest_range, :aliases => "destRange"
        attribute :network
        attribute :next_hop_gateway, :aliases => "nextHopGateway"
        attribute :next_hop_instance, :aliases => "nextHopInstance"
        attribute :next_hop_ip, :aliases => "nextHopIp"
        attribute :next_hop_network, :aliases => "nextHopNetwork"
        attribute :next_hop_vpn_tunnel, :aliases => "nextHopVpnTunnel"
        attribute :priority
        attribute :self_link, :aliases => "selfLink"
        attribute :tags
        attribute :warnings

        def save
          requires :identity, :network, :dest_range, :priority

          data = service.insert_route(identity, network, dest_range, priority, attributes)
          operation = Fog::Compute::Google::Operations.new(:service => service)
                                                      .get(data.name)
          operation.wait_for { !pending? }
          reload
        end

        def destroy(async = true)
          requires :identity

          data = service.delete_route(identity)
          operation = Fog::Compute::Google::Operations.new(:service => service)
                                                      .get(data.name)
          operation.wait_for { ready? } unless async
          operation
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fog-google-1.6.0 lib/fog/compute/google/models/route.rb
fog-google-1.5.0 lib/fog/compute/google/models/route.rb
fog-google-1.4.0 lib/fog/compute/google/models/route.rb
fog-google-1.3.3 lib/fog/compute/google/models/route.rb
fog-google-1.3.2 lib/fog/compute/google/models/route.rb
fog-google-1.3.1 lib/fog/compute/google/models/route.rb
fog-google-1.3.0 lib/fog/compute/google/models/route.rb
fog-google-1.2.2 lib/fog/compute/google/models/route.rb
fog-google-1.2.1 lib/fog/compute/google/models/route.rb
fog-google-1.2.0 lib/fog/compute/google/models/route.rb
fog-google-1.1.0 lib/fog/compute/google/models/route.rb
fog-google-1.0.1 lib/fog/compute/google/models/route.rb
fog-google-1.0.0 lib/fog/compute/google/models/route.rb