Sha256: 978552e1f9e3c558420cb3d6d878b71cb6d4a8569f3a84cdd0a88ed56cf60516

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

module Fog
  module Network
    class AzureRM
      # PublicIP model class for Network Service
      class PublicIp < Fog::Model
        identity :name
        attribute :type
        attribute :location
        attribute :resource_group

        def save
          requires :name
          requires :type
          requires :location
          requires :resource_group

          properties = Azure::ARM::Network::Models::PublicIPAddressPropertiesFormat.new
          properties.public_ipallocation_method = type

          public_ip = Azure::ARM::Network::Models::PublicIPAddress.new
          public_ip.name = name
          public_ip.location = location
          public_ip.properties = properties

          service.create_public_ip(resource_group, name, public_ip)
        end

        def destroy
          service.delete_public_ip(resource_group, name)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.0 lib/fog/azurerm/models/network/public_ip.rb