Sha256: cde1f4244f64522fa24613f59cb2f9f5eff6c36151d3c8f0fe14415f1c7d0233

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

module Fog
  module AzureRM
    class Storage
      # 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://mockaccount.blob.core.windows.net/test_container?comp=list&restype=container'
          url.sub!('https:', 'http:') if options[:scheme] == 'http'
          url
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gitlab-fog-azure-rm-2.2.0 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-2.1.0 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-2.0.1 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-2.0.0 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-1.9.1 lib/fog/azurerm/requests/storage/get_container_url.rb
gitlab-fog-azure-rm-1.9.0 lib/fog/azurerm/requests/storage/get_container_url.rb