Sha256: 5549bc30766921574673f543ca22285ebd21e0400e3f84f723a8dc44d8f50fdb

Contents?: true

Size: 1.63 KB

Versions: 11

Compression:

Stored size: 1.63 KB

Contents

module Vcloud
  module Walker
    module Resource
      class GatewayIpsecVpnService < Entity
        attr_reader :IsEnabled, :Tunnels

        def initialize fog_vpn_service
          @IsEnabled = fog_vpn_service[:IsEnabled]
          if fog_vpn_service[:Tunnel]
            fog_vpn_tunnels = [fog_vpn_service[:Tunnel]].flatten
            @Tunnels = populate_tunnel_info(fog_vpn_tunnels)
          end
        end

        private
        def populate_tunnel_info(fog_vpn_tunnels)
          return if fog_vpn_tunnels.empty?
          fog_vpn_tunnels.collect do |fog_vpn_tunnel|
            @tunnel = {
              :Name => fog_vpn_tunnel[:Name],
              :Description => fog_vpn_tunnel[:Description],
              :ThirdPartyPeerId => fog_vpn_tunnel[:IpsecVpnThirdPartyPeer][:PeerId],
              :PeerId => fog_vpn_tunnel[:PeerId],
              :LocalId => fog_vpn_tunnel[:LocalId],
              :PeerIpAddress => fog_vpn_tunnel[:PeerIpAddress],
              :LocalIpAddress => fog_vpn_tunnel[:LocalIpAddress],
              :PeerSubnet => fog_vpn_tunnel[:PeerSubnet],
              :LocalSubnet => fog_vpn_tunnel[:LocalSubnet],
              :Mtu => fog_vpn_tunnel[:Mtu],
              :IsEnabled => fog_vpn_tunnel[:IsEnabled],
              :IsOperational => fog_vpn_tunnel[:IsOperational]
            }

            @tunnel[:SharedSecret] = "*" * 65 if fog_vpn_tunnel[:SharedSecret]
            @tunnel[:SharedSecretEncrypted] = "******" if fog_vpn_tunnel[:SharedSecretEncrypted]
            @tunnel[:EncryptionProtocol] = "******" if fog_vpn_tunnel[:EncryptionProtocol]
            @tunnel
          end
        end


      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
vcloud-walker-3.6.0 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb
vcloud-walker-3.5.0 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb
vcloud-walker-3.4.0 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb
vcloud-walker-3.3.1 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb
vcloud-walker-3.3.0 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb
vcloud-walker-3.2.3 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb
vcloud-walker-3.2.2 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb
vcloud-walker-3.2.1 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb
vcloud-walker-3.2.0 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb
vcloud-walker-3.1.2 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb
vcloud-walker-3.1.1 lib/vcloud/walker/resource/gateway_ipsec_vpn_service.rb