Sha256: add8e9ee1cfc8690ec89062ca9ba4f7ef62bf4f40bfe8eee739d1b8d65b6f184

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

module Fog
  module Network
    class AzureRM
      # Real class for Network Request
      class Real
        def create_subnet(resource_group, virtual_network_name, subnet_name, addressPrefix)
          subnet_properties = Azure::ARM::Network::Models::SubnetPropertiesFormat.new
          subnet_properties.address_prefix = addressPrefix unless addressPrefix.nil?

          subnet = Azure::ARM::Network::Models::Subnet.new
          subnet.name = subnet_name
          subnet.properties = subnet_properties
          begin
            promise = @network_client.subnets.create_or_update(resource_group, virtual_network_name, subnet_name, subnet)
            promise.value!
          rescue  MsRestAzure::AzureOperationError => e
            msg = "Exception creating Subnet #{subnet_name} in Resource Group: #{resource_group}. #{e.body['error']['message']}"
            raise msg
          end
        end
      end

      # Mock class for Network Request
      class Mock
        def create_subnet(_resource_group, _virtual_network_name, _subnet_name, _addressPrefix)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.1 lib/fog/azurerm/requests/network/create_subnet.rb
fog-azure-rm-0.0.0 lib/fog/azurerm/requests/network/create_subnet.rb