Sha256: 95a9ae68e410ff7ef2134087ba2d498ea9968994d026a7851ab3fdd0f3b4abcc

Contents?: true

Size: 1.89 KB

Versions: 1

Compression:

Stored size: 1.89 KB

Contents

module Fog
  module TrafficManager
    # 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/traffic_manager'
      request :create_or_update_traffic_manager_profile
      request :delete_traffic_manager_profile
      request :get_traffic_manager_profile
      request :list_traffic_manager_profiles

      request :create_or_update_traffic_manager_endpoint
      request :delete_traffic_manager_endpoint
      request :get_traffic_manager_endpoint

      model_path 'fog/azurerm/models/traffic_manager'
      model :traffic_manager_profile
      collection :traffic_manager_profiles

      model :traffic_manager_end_point
      collection :traffic_manager_end_points

      # This class provides the actual implementation for service calls.
      class Real
        def initialize(options)
          begin
            require 'azure_mgmt_traffic_manager'
          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])
          @traffic_mgmt_client = ::Azure::ARM::TrafficManager::TrafficManagerManagementClient.new(credentials, resource_manager_endpoint_url)
          @traffic_mgmt_client.subscription_id = options[:subscription_id]
        end
      end
      # This class provides the mock implementation for unit tests.
      class Mock
        def initialize(_options = {})
          begin
            require 'azure_mgmt_traffic_manager'
          rescue LoadError => e
            retry if require('rubygems')
            raise e.message
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 lib/fog/azurerm/traffic_manager.rb