class Azure::Armrest::Environment
Constants
- China
- Public
Pre-generated environments
- USGovernment
- VALID_KEYS
A list of valid keys that can be passed to the constructor
Attributes
The resource ID used to obtain an AD token
The template gallery endpoint
The template gallery endpoint
The api-version for Active Directory
The Active Directory resource ID
The Active Directory resource ID
The KeyValut service DNS suffix
The KeyVault
service resource ID
The authority used to acquire an AD token
The Environment
name
The publish settings file URL
The resource management endpoint
The resource management endpoint
The service management URL
The DNS suffix for SQL Server instances
The endpoint suffix for storage accounts
The DNS suffix for TrafficManager
Public Class Methods
Automatically discover and create an Environment
given a resource manager endpoint. The options
hash must include an endpoint :url key. It may also include a :name (recommended), and http proxy options.
# File lib/azure/armrest/environment.rb, line 94 def self.discover(options) url = options.fetch(:url) name = options[:name] || 'Custom' uri = Addressable::URI.join(url, '/metadata/', 'endpoints') uri.query = "api-version=1.0" response = ArmrestService.send( :rest_get, :url => uri.to_s, :proxy => options[:proxy], :ssl_version => options[:ssl_version], :ssl_verify => options[:ssl_verify] ) endpoint = Endpoint.new(response.body) new( :name => name, :gallery_url => endpoint.gallery_endpoint, :graph_url => endpoint.graph_endpoint, :active_directory_authority => endpoint.authentication.login_endpoint, :active_directory_resource_id => endpoint.authentication.audiences.first, :resource_manager_url => url ) end
Creates a new Azure::Armrest::Environment
object. At a minimum, the options hash must include the :name, :active_directory_authority and :active_directory_resource_id.
Note that there are pre-generated environments already for Public
and US Government environments.
# File lib/azure/armrest/environment.rb, line 71 def initialize(options) options.symbolize_keys.each do |key, value| raise ArgumentError, "Invalid key '#{key}'" unless VALID_KEYS.include?(key) instance_variable_set("@#{key}", value) end %i[name active_directory_authority resource_manager_url].each do |key| unless instance_variable_get("@#{key}") raise ArgumentError, "Mandatory argument '#{key}' not set" end end end