Sha256: e06d54cf7e78a4a29b064e1080164232bd1e76491374e85c851898715bd3661f

Contents?: true

Size: 1.83 KB

Versions: 47

Compression:

Stored size: 1.83 KB

Contents

module Fog
  module Network
    class AzureRM
      # Real class for Network Security rule Request
      class Real
        def get_network_security_rule(resource_group_name, network_security_group_name, security_rule_name)
          msg = "Getting Network Security Rule #{security_rule_name} from Resource Group #{resource_group_name}."
          Fog::Logger.debug msg

          begin
            security_rule = @network_client.security_rules.get(resource_group_name, network_security_group_name, security_rule_name)
          rescue MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, msg)
          end

          Fog::Logger.debug "Network Security Rule #{security_rule_name} retrieved successfully."
          security_rule
        end
      end

      # Mock class for Network Security Rule Request
      class Mock
        def get_network_security_rule(*)
          nsr = '{
              "name":"myNsRule",
              "id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/myNsg/securityRules/myNsRule",
              "etag":"W/\"00000000-0000-0000-0000-000000000000\"",
              "properties":{
                "provisioningState":"Succeeded",
                "description":"description-of-this-rule",
                "protocol": "*",
                "sourcePortRange":"source-port-range",
                "destinationPortRange":"destination-port-range",
                "sourceAddressPrefix":"*",
                "destinationAddressPrefix":"*",
                "access":"Allow",
                "priority":6500,
                "direction":"Inbound"
              }
          }'
          nsr_mapper = Azure::ARM::Network::Models::SecurityRule.mapper
          @network_client.deserialize(nsr_mapper, JSON.load(nsr), 'result.body')
        end
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 4 rubygems

Version Path
fog-azure-rm-0.6.0 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.5.3 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.5.2 lib/fog/azurerm/requests/network/get_network_security_rule.rb
far-gem-0.5.6 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.5.1 lib/fog/azurerm/requests/network/get_network_security_rule.rb
far-gem-0.5.5 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.5.0 lib/fog/azurerm/requests/network/get_network_security_rule.rb
far-gem-0.5.4 lib/fog/azurerm/requests/network/get_network_security_rule.rb
far-gem-0.5.3 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.4.9 lib/fog/azurerm/requests/network/get_network_security_rule.rb
far-gem-0.5.2 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.4.8 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.4.7 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.4.6 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.4.5 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-temp-0.0.5 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.4.4 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.4.3 lib/fog/azurerm/requests/network/get_network_security_rule.rb
far-gem-0.5.1 lib/fog/azurerm/requests/network/get_network_security_rule.rb
fog-azure-rm-0.4.2 lib/fog/azurerm/requests/network/get_network_security_rule.rb