Sha256: 8b44de728919e7ec5585446c78403152a0ea28a4f4e6249c7bf3a466e80a8334

Contents?: true

Size: 1.95 KB

Versions: 47

Compression:

Stored size: 1.95 KB

Contents

module Fog
  module Network
    class AzureRM
      # Real class for Network Request
      class Real
        def list_network_security_rules(resource_group, network_security_group_name)
          msg = "Getting list of Network Security Rule in Security Group #{network_security_group_name} from Resource Group #{resource_group}."
          Fog::Logger.debug msg

          begin
            nsr_list_result = @network_client.security_rules.list_as_lazy(resource_group, network_security_group_name)
          rescue MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, msg)
          end

          Fog::Logger.debug "Network Security Rules list retrieved successfully from Resource Group #{resource_group}."
          nsr_list_result.value
        end
      end

      # Mock class for Network Security Rule Request
      class Mock
        def list_network_security_rules(*)
          nsr_list = '{
            "value":[
              {
                "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":100,
                  "direction":"Inbound"
                }
              }
          ]
          }'
          nsr_mapper = Azure::ARM::Network::Models::SecurityRuleListResult.mapper
          @network_client.deserialize(nsr_mapper, JSON.load(nsr_list), '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/list_network_security_rules.rb
fog-azure-rm-0.5.3 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.5.2 lib/fog/azurerm/requests/network/list_network_security_rules.rb
far-gem-0.5.6 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.5.1 lib/fog/azurerm/requests/network/list_network_security_rules.rb
far-gem-0.5.5 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.5.0 lib/fog/azurerm/requests/network/list_network_security_rules.rb
far-gem-0.5.4 lib/fog/azurerm/requests/network/list_network_security_rules.rb
far-gem-0.5.3 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.4.9 lib/fog/azurerm/requests/network/list_network_security_rules.rb
far-gem-0.5.2 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.4.8 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.4.7 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.4.6 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.4.5 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-temp-0.0.5 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.4.4 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.4.3 lib/fog/azurerm/requests/network/list_network_security_rules.rb
far-gem-0.5.1 lib/fog/azurerm/requests/network/list_network_security_rules.rb
fog-azure-rm-0.4.2 lib/fog/azurerm/requests/network/list_network_security_rules.rb