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

Instance Method Summary collapse

Instance Method Details

#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_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

#validate_params(required_params, input_params) ⇒ Object

Make sure if input_params(Hash) contains all keys present in required_params(Array)



12
13
14
15
16
17
18
# File 'lib/fog/azurerm/utilities/general.rb', line 12

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