Class: Kitchen::Driver::Azure::Environments::Environment
- Inherits:
-
Struct
- Object
- Struct
- Kitchen::Driver::Azure::Environments::Environment
- Defined in:
- lib/kitchen/driver/azure/environments.rb
Overview
One Azure cloud's endpoints.
Instance Attribute Summary collapse
-
#authentication_endpoint ⇒ String
readonly
Entra ID (Azure AD) token endpoint.
-
#name ⇒ String
readonly
Canonical cloud name, e.g.
-
#resource_manager_url ⇒ String
readonly
Base URL for Azure Resource Manager requests.
-
#token_audience ⇒ String
readonly
Audience/resource the access token is requested for.
Instance Method Summary collapse
-
#default_scope ⇒ String
The v2.0 scope covering every permission this driver needs.
-
#token_url(tenant_id) ⇒ String
The OAuth2 v1.0 token URL for a tenant in this cloud.
-
#token_url_v2(tenant_id) ⇒ String
The OAuth2 v2.0 token URL for a tenant in this cloud.
-
#with_authority(authority) ⇒ Environment
A copy of this cloud pointed at a different Entra ID authority.
Instance Attribute Details
#authentication_endpoint ⇒ String (readonly)
Returns Entra ID (Azure AD) token endpoint.
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 |
# File 'lib/kitchen/driver/azure/environments.rb', line 21 Environment = Struct.new(:name, :resource_manager_url, :authentication_endpoint, :token_audience) do # The OAuth2 v1.0 token URL for a tenant in this cloud. # # @param tenant_id [String] # @return [String] def token_url(tenant_id) "#{authentication_endpoint.chomp("/")}/#{tenant_id}/oauth2/token" end # The OAuth2 v2.0 token URL for a tenant in this cloud. # # Federated (assertion-based) client credentials are documented # against v2.0, which takes a +scope+ rather than a +resource+. # # @param tenant_id [String] # @return [String] def token_url_v2(tenant_id) "#{authentication_endpoint.chomp("/")}/#{tenant_id}/oauth2/v2.0/token" end # The v2.0 scope covering every permission this driver needs. # # @return [String] e.g. +"https://management.azure.com/.default"+ def default_scope "#{resource_manager_url.chomp("/")}/.default" end # A copy of this cloud pointed at a different Entra ID authority. # # Platforms that issue federated tokens - AKS in particular - set # +AZURE_AUTHORITY_HOST+ to say where those tokens should be # exchanged. # # @param authority [String, nil] the authority URL, or nil to keep this one. # @return [Environment] def () return self if .to_s.empty? self.class.new(name, resource_manager_url, , token_audience).freeze end end |
#name ⇒ String (readonly)
Returns canonical cloud name, e.g. "AzureUSGovernment".
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 |
# File 'lib/kitchen/driver/azure/environments.rb', line 21 Environment = Struct.new(:name, :resource_manager_url, :authentication_endpoint, :token_audience) do # The OAuth2 v1.0 token URL for a tenant in this cloud. # # @param tenant_id [String] # @return [String] def token_url(tenant_id) "#{authentication_endpoint.chomp("/")}/#{tenant_id}/oauth2/token" end # The OAuth2 v2.0 token URL for a tenant in this cloud. # # Federated (assertion-based) client credentials are documented # against v2.0, which takes a +scope+ rather than a +resource+. # # @param tenant_id [String] # @return [String] def token_url_v2(tenant_id) "#{authentication_endpoint.chomp("/")}/#{tenant_id}/oauth2/v2.0/token" end # The v2.0 scope covering every permission this driver needs. # # @return [String] e.g. +"https://management.azure.com/.default"+ def default_scope "#{resource_manager_url.chomp("/")}/.default" end # A copy of this cloud pointed at a different Entra ID authority. # # Platforms that issue federated tokens - AKS in particular - set # +AZURE_AUTHORITY_HOST+ to say where those tokens should be # exchanged. # # @param authority [String, nil] the authority URL, or nil to keep this one. # @return [Environment] def () return self if .to_s.empty? self.class.new(name, resource_manager_url, , token_audience).freeze end end |
#resource_manager_url ⇒ String (readonly)
Returns base URL for Azure Resource Manager requests.
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 |
# File 'lib/kitchen/driver/azure/environments.rb', line 21 Environment = Struct.new(:name, :resource_manager_url, :authentication_endpoint, :token_audience) do # The OAuth2 v1.0 token URL for a tenant in this cloud. # # @param tenant_id [String] # @return [String] def token_url(tenant_id) "#{authentication_endpoint.chomp("/")}/#{tenant_id}/oauth2/token" end # The OAuth2 v2.0 token URL for a tenant in this cloud. # # Federated (assertion-based) client credentials are documented # against v2.0, which takes a +scope+ rather than a +resource+. # # @param tenant_id [String] # @return [String] def token_url_v2(tenant_id) "#{authentication_endpoint.chomp("/")}/#{tenant_id}/oauth2/v2.0/token" end # The v2.0 scope covering every permission this driver needs. # # @return [String] e.g. +"https://management.azure.com/.default"+ def default_scope "#{resource_manager_url.chomp("/")}/.default" end # A copy of this cloud pointed at a different Entra ID authority. # # Platforms that issue federated tokens - AKS in particular - set # +AZURE_AUTHORITY_HOST+ to say where those tokens should be # exchanged. # # @param authority [String, nil] the authority URL, or nil to keep this one. # @return [Environment] def () return self if .to_s.empty? self.class.new(name, resource_manager_url, , token_audience).freeze end end |
#token_audience ⇒ String (readonly)
Returns audience/resource the access token is requested for.
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 |
# File 'lib/kitchen/driver/azure/environments.rb', line 21 Environment = Struct.new(:name, :resource_manager_url, :authentication_endpoint, :token_audience) do # The OAuth2 v1.0 token URL for a tenant in this cloud. # # @param tenant_id [String] # @return [String] def token_url(tenant_id) "#{authentication_endpoint.chomp("/")}/#{tenant_id}/oauth2/token" end # The OAuth2 v2.0 token URL for a tenant in this cloud. # # Federated (assertion-based) client credentials are documented # against v2.0, which takes a +scope+ rather than a +resource+. # # @param tenant_id [String] # @return [String] def token_url_v2(tenant_id) "#{authentication_endpoint.chomp("/")}/#{tenant_id}/oauth2/v2.0/token" end # The v2.0 scope covering every permission this driver needs. # # @return [String] e.g. +"https://management.azure.com/.default"+ def default_scope "#{resource_manager_url.chomp("/")}/.default" end # A copy of this cloud pointed at a different Entra ID authority. # # Platforms that issue federated tokens - AKS in particular - set # +AZURE_AUTHORITY_HOST+ to say where those tokens should be # exchanged. # # @param authority [String, nil] the authority URL, or nil to keep this one. # @return [Environment] def () return self if .to_s.empty? self.class.new(name, resource_manager_url, , token_audience).freeze end end |
Instance Method Details
#default_scope ⇒ String
The v2.0 scope covering every permission this driver needs.
44 45 46 |
# File 'lib/kitchen/driver/azure/environments.rb', line 44 def default_scope "#{resource_manager_url.chomp("/")}/.default" end |
#token_url(tenant_id) ⇒ String
The OAuth2 v1.0 token URL for a tenant in this cloud.
26 27 28 |
# File 'lib/kitchen/driver/azure/environments.rb', line 26 def token_url(tenant_id) "#{authentication_endpoint.chomp("/")}/#{tenant_id}/oauth2/token" end |
#token_url_v2(tenant_id) ⇒ String
The OAuth2 v2.0 token URL for a tenant in this cloud.
Federated (assertion-based) client credentials are documented
against v2.0, which takes a scope rather than a resource.
37 38 39 |
# File 'lib/kitchen/driver/azure/environments.rb', line 37 def token_url_v2(tenant_id) "#{authentication_endpoint.chomp("/")}/#{tenant_id}/oauth2/v2.0/token" end |
#with_authority(authority) ⇒ Environment
A copy of this cloud pointed at a different Entra ID authority.
Platforms that issue federated tokens - AKS in particular - set
AZURE_AUTHORITY_HOST to say where those tokens should be
exchanged.
56 57 58 59 60 |
# File 'lib/kitchen/driver/azure/environments.rb', line 56 def () return self if .to_s.empty? self.class.new(name, resource_manager_url, , token_audience).freeze end |