Sha256: 0cac5e03cc51e33c8f85ace47642a5c4656773ff9fda2ad950ae78d8d4d1dfe6

Contents?: true

Size: 1.6 KB

Versions: 1

Compression:

Stored size: 1.6 KB

Contents

require 'fog/azurerm/core'
module Fog
  module Storage
    # This class registers models, requests and collections
    class AzureRM < Fog::Service
      requires :tenant_id
      requires :client_id
      requires :client_secret
      requires :subscription_id

      request_path 'fog/azurerm/requests/storage'
      request :create_storage_account
      request :list_storage_accounts
      request :delete_storage_account
      request :list_storage_account_for_rg
      request :check_storage_account_name_availability

      model_path 'fog/azurerm/models/storage'
      model :storage_account
      collection :storage_accounts
      # This class provides the mock implementation for unit tests.
      class Mock
        def initialize(_options = {})
          begin
            require 'azure_mgmt_storage'
          rescue LoadError => e
            retry if require('rubygems')
            raise e.message
          end
        end
      end
      # This class provides the actual implemention for service calls.
      class Real
        def initialize(options)
          begin
            require 'azure_mgmt_storage'
          rescue LoadError => e
            retry if require('rubygems')
            raise e.message
          end

          credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret])
          @storage_mgmt_client = ::Azure::ARM::Storage::StorageManagementClient.new(credentials)
          @storage_mgmt_client.subscription_id = options[:subscription_id]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.3 lib/fog/azurerm/storage.rb