Sha256: 7c08a089e91734050f0df0955c561a17953f566fe4bb093711565eb560c65512

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

module Fog
  module Storage
    class AzureRM
      # This class provides the actual implemention for service calls.
      class Real
        # Get a public container url from Azure storage container
        #
        # @param container_name [String] Name of container
        #
        # @return [String] - url for container
        #
        def get_container_url(container_name, options = {})
          query = { 'comp' => 'list', 'restype' => 'container' }
          uri = @blob_client.generate_uri(container_name, query, { encode: true })

          if options[:scheme] == 'http'
            uri.to_s.gsub('https:', 'http:')
          else
            uri.to_s
          end
        end
      end

      # This class provides the mock implementation for unit tests.
      class Mock
        def get_container_url(_container_name, options = {})
          url = 'https://sa.blob.core.windows.net/test_container?comp=list&restype=container'
          url.gsub!('https:', 'http:') if options[:scheme] == 'http'
          url
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gitlab-fog-azure-rm-1.8.0 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-1.7.0 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-1.6.0 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-1.5.0 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-1.4.0 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-1.3.0 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-1.2.0 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-1.1.1 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-1.0.1 lib/fog/azurerm/requests/storage/get_container_url.rb