class Fog::TrafficManager::AzureRM::Mock

This class provides the mock implementation for unit tests.

This class provides the mock implementation for unit tests.

Mock class for TrafficManager Request

This class provides the mock implementation for unit tests.

Mock class for TrafficManager Request

Mock class for TrafficManager Request

Mock class for Network Request

Mock class for Network Request

Mock class for TrafficManager Request

This class provides the mock implementation for unit tests.

Public Class Methods

new(_options = {}) click to toggle source
# File lib/fog/azurerm/traffic_manager.rb, line 51
def initialize(_options = {})
  begin
    require 'azure_mgmt_traffic_manager'
  rescue LoadError => e
    retry if require('rubygems')
    raise e.message
  end
end

Public Instance Methods

check_traffic_manager_endpoint_exists(*) click to toggle source
# File lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb, line 25
def check_traffic_manager_endpoint_exists(*)
  true
end
check_traffic_manager_profile_exists(*) click to toggle source
# File lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb, line 25
def check_traffic_manager_profile_exists(*)
  true
end
create_or_update_traffic_manager_endpoint(*) click to toggle source
# File lib/fog/azurerm/requests/traffic_manager/create_or_update_traffic_manager_endpoint.rb, line 36
def create_or_update_traffic_manager_endpoint(*)
  endpoint = {
    'name' => '{endpoint-name}',
    'type' => 'Microsoft.Network/trafficManagerProfiles/externalEndpoints',
    'properties' => {
      'target' => 'myendpoint.contoso.com',
      'endpointStatus' => 'Enabled',
      'weight' => 10,
      'priority' => 5,
      'endpointLocation' => 'northeurope'
    }
  }
  endpoint_mapper = Azure::ARM::TrafficManager::Models::Endpoint.mapper
  @traffic_mgmt_client.deserialize(endpoint_mapper, endpoint, 'result.body')
end
create_or_update_traffic_manager_profile(*) click to toggle source
# File lib/fog/azurerm/requests/traffic_manager/create_or_update_traffic_manager_profile.rb, line 61
def create_or_update_traffic_manager_profile(*)
  profile = {
    'location' => 'global',
    'tags' => {},
    'properties' => {
      'profileStatus' => 'Enabled',
      'trafficRoutingMethod' => 'Performance',
      'dnsConfig' => {
        'relativeName' => 'myapp',
        'ttl' => 30
      },
      'monitorConfig' => {
        'protocol' => 'http',
        'port' => 80,
        'path' => '/monitorpage.aspx'
      },
      'endpoints' => [
        {
          'name' => '{endpoint-name}',
          'type' => 'Microsoft.Network/trafficManagerProfiles/azureEndpoints',
          'properties' => {
            'targetResourceId' => '{resource ID of target resource in Azure}',
            'endpointStatus' => 'Enabled',
            'weight' => 10,
            'priority' => 3
          }
        },
        {
          'name' => '{endpoint-name}',
          'type' => 'Microsoft.Network/trafficManagerProfiles/externalEndpoints',
          'properties' => {
            'target' => 'myendpoint.contoso.com',
            'endpointStatus' => 'Enabled',
            'weight' => 10,
            'priority' => 5,
            'endpointLocation' => 'northeurope'
          }
        },
        {
          'name' => '{endpoint-name}',
          'type' => 'Microsoft.Network/trafficManagerProfiles/nestedEndpoints',
          'properties' => {
            'targetResourceId' => '{resource ID of child Traffic Manager profile}',
            'endpointStatus' => 'Enabled',
            'weight' => 10,
            'priority' => 1,
            'endpointLocation' => 'westeurope',
            'minChildEndpoints' => 1
          }
        }
      ]
    }
  }
  profile_mapper = Azure::ARM::TrafficManager::Models::Profile.mapper
  @traffic_mgmt_client.deserialize(profile_mapper, profile, 'result.body')
end
delete_traffic_manager_endpoint(resource_group, name, _traffic_manager_profile_name, _type) click to toggle source
# File lib/fog/azurerm/requests/traffic_manager/delete_traffic_manager_endpoint.rb, line 21
def delete_traffic_manager_endpoint(resource_group, name, _traffic_manager_profile_name, _type)
  Fog::Logger.debug "Traffic Manager End Point #{name} from Resource group #{resource_group} deleted successfully."
  true
end
delete_traffic_manager_profile(resource_group, name) click to toggle source
# File lib/fog/azurerm/requests/traffic_manager/delete_traffic_manager_profile.rb, line 19
def delete_traffic_manager_profile(resource_group, name)
  Fog::Logger.debug "Traffic Manager Profile #{name} from Resource group #{resource_group} deleted successfully."
  true
end
get_traffic_manager_end_point(*) click to toggle source
# File lib/fog/azurerm/requests/traffic_manager/get_traffic_manager_endpoint.rb, line 21
def get_traffic_manager_end_point(*)
  endpoint = {
    'name' => '{endpoint-name}',
    'type' => 'Microsoft.Network/trafficManagerProfiles/externalEndpoints',
    'properties' => {
      'target' => 'myendpoint.contoso.com',
      'endpointStatus' => 'Enabled',
      'weight' => 10,
      'priority' => 5,
      'endpointLocation' => 'northeurope'
    }
  }
  endpoint_mapper = Azure::ARM::TrafficManager::Models::Endpoint.mapper
  @traffic_mgmt_client.deserialize(endpoint_mapper, endpoint, 'result.body')
end
get_traffic_manager_profile(*) click to toggle source
# File lib/fog/azurerm/requests/traffic_manager/get_traffic_manager_profile.rb, line 21
def get_traffic_manager_profile(*)
  profile = {
    'location' => 'global',
    'tags' => {},
    'properties' => {
      'profileStatus' => 'Enabled',
      'trafficRoutingMethod' => 'Performance',
      'dnsConfig' => {
        'relativeName' => 'myapp',
        'ttl' => 30
      },
      'monitorConfig' => {
        'protocol' => 'http',
        'port' => 80,
        'path' => '/monitorpage.aspx'
      },
      'endpoints' => [
        {
          'name' => '{endpoint-name}',
          'type' => 'Microsoft.Network/trafficManagerProfiles/azureEndpoints',
          'properties' => {
            'targetResourceId' => '{resource ID of target resource in Azure}',
            'endpointStatus' => 'Enabled',
            'weight' => 10,
            'priority' => 3
          }
        },
        {
          'name' => '{endpoint-name}',
          'type' => 'Microsoft.Network/trafficManagerProfiles/externalEndpoints',
          'properties' => {
            'target' => 'myendpoint.contoso.com',
            'endpointStatus' => 'Enabled',
            'weight' => 10,
            'priority' => 5,
            'endpointLocation' => 'northeurope'
          }
        },
        {
          'name' => '{endpoint-name}',
          'type' => 'Microsoft.Network/trafficManagerProfiles/nestedEndpoints',
          'properties' => {
            'targetResourceId' => '{resource ID of child Traffic Manager profile}',
            'endpointStatus' => 'Enabled',
            'weight' => 10,
            'priority' => 1,
            'endpointLocation' => 'westeurope',
            'minChildEndpoints' => 1
          }
        }
      ]
    }
  }
  profile_mapper = Azure::ARM::TrafficManager::Models::Profile.mapper
  @traffic_mgmt_client.deserialize(profile_mapper, profile, 'result.body')
end
list_traffic_manager_profiles(*) click to toggle source
# File lib/fog/azurerm/requests/traffic_manager/list_traffic_manager_profiles.rb, line 21
def list_traffic_manager_profiles(*)
  profiles = [
    {
      'location' => 'global',
      'tags' => {},
      'properties' => {
        'profileStatus' => 'Enabled',
        'trafficRoutingMethod' => 'Performance',
        'dnsConfig' => {
          'relativeName' => 'myapp',
          'ttl' => 30
        },
        'monitorConfig' => {
          'protocol' => 'http',
          'port' => 80,
          'path' => '/monitorpage.aspx'
        },
        'endpoints' => [
          {
            'name' => '{endpoint-name}',
            'type' => 'Microsoft.Network/trafficManagerProfiles/azureEndpoints',
            'properties' => {
              'targetResourceId' => '{resource ID of target resource in Azure}',
              'endpointStatus' => 'Enabled',
              'weight' => 10,
              'priority' => 3
            }
          },
          {
            'name' => '{endpoint-name}',
            'type' => 'Microsoft.Network/trafficManagerProfiles/externalEndpoints',
            'properties' => {
              'target' => 'myendpoint.contoso.com',
              'endpointStatus' => 'Enabled',
              'weight' => 10,
              'priority' => 5,
              'endpointLocation' => 'northeurope'
            }
          },
          {
            'name' => '{endpoint-name}',
            'type' => 'Microsoft.Network/trafficManagerProfiles/nestedEndpoints',
            'properties' => {
              'targetResourceId' => '{resource ID of child Traffic Manager profile}',
              'endpointStatus' => 'Enabled',
              'weight' => 10,
              'priority' => 1,
              'endpointLocation' => 'westeurope',
              'minChildEndpoints' => 1
            }
          }
        ]
      }
    }
  ]
  profiles_mapper = Azure::ARM::TrafficManager::Models::ProfileListResult.mapper
  @traffic_mgmt_client.deserialize(profiles_mapper, profiles, 'result.body')
end