Top Level Namespace
Defined Under Namespace
Modules: Fog
Constant Summary collapse
- AZURE_RESOURCE =
'https://management.azure.com'.freeze
- DEFAULT_ADDRESS_PREFIXES =
['10.2.0.0/16'].freeze
- SUBNET =
'Subnet'.freeze
- PUBLIC_IP =
'Public-IP-Address'.freeze
- NETWORK_SECURITY_GROUP =
'Network-Security-Group'.freeze
- STANDARD_STORAGE =
'Standard'.freeze
- PREMIUM_STORAGE =
'Premium'.freeze
- ALLOWED_STANDARD_REPLICATION =
%w(LRS ZRS GRS RAGRS).freeze
- API_VERSION =
'2016-06-01'.freeze
- FAULT_DOMAIN_COUNT =
3.freeze
- UPDATE_DOMAIN_COUNT =
5.freeze
- WINDOWS =
'windows'.freeze
- VPN =
'Vpn'.freeze
- MICROSOFT_PEERING =
'MicrosoftPeering'.freeze
- RESOURCE_GROUP_NAME =
4- RESOURCE_PROVIDER_NAMESPACE =
6- RESOURCE_TYPE =
7- RESOURCE_NAME =
8- AZURE_ENDPOINTS =
'azureEndpoints'.freeze
- EXTERNAL_ENDPOINTS =
'externalEndpoints'.freeze
- NESTED_ENDPOINTS =
'nestedEndpoints'.freeze
- GLOBAL =
'global'.freeze
- WHITE_SPACE =
' '.freeze
Instance Method Summary collapse
-
#get_circuit_name_from_id(circuit_id) ⇒ Object
Pick Express Route Circuit name from Id(String).
-
#get_end_point_type(endpoint_type) ⇒ Object
Extract Endpoint type from (String).
- #get_record_type(type) ⇒ Object
- #get_resource_from_resource_id(resource_id, position) ⇒ Object
-
#get_resource_group_from_id(id) ⇒ Object
Pick Resource Group name from Azure Resource Id(String).
-
#get_traffic_manager_profile_name_from_endpoint_id(endpoint_id) ⇒ Object
Extract Traffic Manager Profile Name from Endpoint id(String).
-
#get_virtual_network_from_id(subnet_id) ⇒ Object
Pick Virtual Network name from Subnet Resource Id(String).
- #raise_azure_exception(exception, msg) ⇒ Object
-
#validate_params(required_params, input_params) ⇒ Object
Make sure if input_params(Hash) contains all keys present in required_params(Array).
Instance Method Details
#get_circuit_name_from_id(circuit_id) ⇒ Object
Pick Express Route Circuit name from Id(String)
22 23 24 |
# File 'lib/fog/azurerm/utilities/general.rb', line 22 def get_circuit_name_from_id(circuit_id) circuit_id.split('/')[8] end |
#get_end_point_type(endpoint_type) ⇒ Object
Extract Endpoint type from (String)
12 13 14 |
# File 'lib/fog/azurerm/utilities/general.rb', line 12 def get_end_point_type(endpoint_type) endpoint_type.split('/')[2] end |
#get_record_type(type) ⇒ Object
26 27 28 |
# File 'lib/fog/azurerm/utilities/general.rb', line 26 def get_record_type(type) type.split('/').last end |
#get_resource_from_resource_id(resource_id, position) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/fog/azurerm/utilities/general.rb', line 45 def get_resource_from_resource_id(resource_id, position) data = resource_id.split('/') unless resource_id.nil? raise 'Invalid Resource ID' if data.count < 9 && data.count != 5 data[position] end |
#get_resource_group_from_id(id) ⇒ Object
Pick Resource Group name from Azure Resource Id(String)
2 3 4 |
# File 'lib/fog/azurerm/utilities/general.rb', line 2 def get_resource_group_from_id(id) id.split('/')[4] end |
#get_traffic_manager_profile_name_from_endpoint_id(endpoint_id) ⇒ Object
Extract Traffic Manager Profile Name from Endpoint id(String)
17 18 19 |
# File 'lib/fog/azurerm/utilities/general.rb', line 17 def get_traffic_manager_profile_name_from_endpoint_id(endpoint_id) endpoint_id.split('/')[8] end |
#get_virtual_network_from_id(subnet_id) ⇒ Object
Pick Virtual Network name from Subnet Resource Id(String)
7 8 9 |
# File 'lib/fog/azurerm/utilities/general.rb', line 7 def get_virtual_network_from_id(subnet_id) subnet_id.split('/')[8] end |
#raise_azure_exception(exception, msg) ⇒ Object
30 31 32 33 34 |
# File 'lib/fog/azurerm/utilities/general.rb', line 30 def raise_azure_exception(exception, msg) = "Exception in #{msg} #{exception.body['error']['message'] unless exception.body['error']['message'].nil?} Type: #{exception.class} \n " Fog::Logger.debug exception.backtrace raise end |
#validate_params(required_params, input_params) ⇒ Object
Make sure if input_params(Hash) contains all keys present in required_params(Array)
37 38 39 40 41 42 43 |
# File 'lib/fog/azurerm/utilities/general.rb', line 37 def validate_params(required_params, input_params) missing_params = required_params.select { |param| param unless input_params.key?(param) } if missing_params.any? raise(ArgumentError, "Missing Parameters: #{missing_params.join(', ')} required for this operation") end end |