lib/fog/azurerm/dns.rb in fog-azure-rm-0.1.2 vs lib/fog/azurerm/dns.rb in fog-azure-rm-0.2.0
- old
+ new
@@ -4,22 +4,24 @@
class AzureRM < Fog::Service
requires :tenant_id
requires :client_id
requires :client_secret
requires :subscription_id
+ recognizes :environment
request_path 'fog/azurerm/requests/dns'
request :create_or_update_zone
request :delete_zone
- request :check_for_zone
+ request :check_zone_exists
request :list_zones
request :get_zone
request :create_or_update_record_set
request :delete_record_set
request :list_record_sets
request :get_records_from_record_set
request :get_record_set
+ request :check_record_set_exists
model_path 'fog/azurerm/models/dns'
model :zone
collection :zones
model :record_set
@@ -39,20 +41,26 @@
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])
- @dns_client = ::Azure::ARM::Dns::DnsManagementClient.new(credentials, resource_manager_endpoint_url)
+ options[:environment] = 'AzureCloud' if options[:environment].nil?
+
+ credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret], options[:environment])
+ telemetry = "fog-azure-rm/#{Fog::AzureRM::VERSION}"
+ @dns_client = ::Azure::ARM::Dns::DnsManagementClient.new(credentials, resource_manager_endpoint_url(options[:environment]))
@dns_client.subscription_id = options[:subscription_id]
+ @dns_client.add_user_agent_information(telemetry)
@tenant_id = options[:tenant_id]
@client_id = options[:client_id]
@client_secret = options[:client_secret]
+ @environment = options[:environment]
@resources = Fog::Resources::AzureRM.new(
tenant_id: options[:tenant_id],
client_id: options[:client_id],
client_secret: options[:client_secret],
- subscription_id: options[:subscription_id]
+ subscription_id: options[:subscription_id],
+ environment: options[:environment]
)
end
end
end
end