Class: Fog::TrafficManager::AzureRM::Mock
- Inherits:
-
Object
- Object
- Fog::TrafficManager::AzureRM::Mock
- Defined in:
- lib/fog/azurerm/traffic_manager.rb,
lib/fog/azurerm/requests/traffic_manager/get_traffic_manager_profile.rb,
lib/fog/azurerm/requests/traffic_manager/get_traffic_manager_endpoint.rb,
lib/fog/azurerm/requests/traffic_manager/list_traffic_manager_profiles.rb,
lib/fog/azurerm/requests/traffic_manager/delete_traffic_manager_profile.rb,
lib/fog/azurerm/requests/traffic_manager/delete_traffic_manager_endpoint.rb,
lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb,
lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb,
lib/fog/azurerm/requests/traffic_manager/create_or_update_traffic_manager_profile.rb,
lib/fog/azurerm/requests/traffic_manager/create_or_update_traffic_manager_endpoint.rb
Overview
Mock class for TrafficManager Request
Instance Method Summary collapse
- #check_traffic_manager_endpoint_exists ⇒ Object
- #check_traffic_manager_profile_exists ⇒ Object
- #create_or_update_traffic_manager_endpoint ⇒ Object
- #create_or_update_traffic_manager_profile ⇒ Object
- #delete_traffic_manager_endpoint(resource_group, name, _traffic_manager_profile_name, _type) ⇒ Object
- #delete_traffic_manager_profile(resource_group, name) ⇒ Object
- #get_traffic_manager_end_point ⇒ Object
- #get_traffic_manager_profile ⇒ Object
-
#initialize(_options = {}) ⇒ Mock
constructor
A new instance of Mock.
- #list_traffic_manager_profiles ⇒ Object
Constructor Details
#initialize(_options = {}) ⇒ Mock
Returns a new instance of Mock.
51 52 53 54 55 56 57 58 |
# File 'lib/fog/azurerm/traffic_manager.rb', line 51 def initialize( = {}) begin require 'azure_mgmt_traffic_manager' rescue LoadError => e retry if require('rubygems') raise e. end end |
Instance Method Details
#check_traffic_manager_endpoint_exists ⇒ Object
25 26 27 |
# 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 ⇒ Object
25 26 27 |
# 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 ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# 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 ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/fog/azurerm/requests/traffic_manager/create_or_update_traffic_manager_profile.rb', line 71 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) ⇒ Object
21 22 23 24 |
# 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) ⇒ Object
19 20 21 22 |
# 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 ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# 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 ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# 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 ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# 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 |