Class: Fog::AzureRM::Identity::BaseClient

Inherits:
Object
  • Object
show all
Includes:
Utilities::General
Defined in:
lib/fog/azurerm/identity/base_client.rb

Overview

BaseClient is responsible for fetching credentials and refreshing them when necessary.

Constant Summary collapse

FetchCredentialsError =
Class.new(RuntimeError)
DEFAULT_TIMEOUT_S =
30

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities::General

#authority_url, #get_blob_endpoint, #get_blob_endpoint_with_domain, #get_circuit_name_from_id, #get_end_point_type, #get_hash_from_object, #get_image_name, #get_record_set_from_id, #get_record_type, #get_resource_from_resource_id, #get_resource_group_from_id, #get_subscription_id, #get_traffic_manager_profile_name_from_endpoint_id, #get_type_from_recordset_type, #get_virtual_machine_from_id, #get_virtual_network_from_id, #parse_storage_object, #raise_azure_exception, #random_string, #remove_trailing_periods_from_path_segments, #storage_endpoint_suffix, #storage_resource, #validate_params

Instance Attribute Details

#credentialsObject

Returns the value of attribute credentials.



12
13
14
# File 'lib/fog/azurerm/identity/base_client.rb', line 12

def credentials
  @credentials
end

Instance Method Details

#fetch_credentialsObject

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/fog/azurerm/identity/base_client.rb', line 18

def fetch_credentials
  raise NotImplementedError
end

#fetch_credentials_if_neededObject



22
23
24
25
26
# File 'lib/fog/azurerm/identity/base_client.rb', line 22

def fetch_credentials_if_needed
  @credentials = fetch_credentials if @credentials.nil? || refresh_needed?

  credentials
end

#refresh_needed?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
# File 'lib/fog/azurerm/identity/base_client.rb', line 28

def refresh_needed?
  return true unless @credentials

  @credentials.refresh_needed?
end