Sha256: 6c9ea2806495d3d450bac36bade6d5b2e5e509cb91c242242c90c641215b36df

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

require 'fog/azurerm/core'
# rubocop:disable LineLength
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
          puts "Tenand Id: #{options[:tenant_id]}"
        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

2 entries across 2 versions & 1 rubygems

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