Class: OutputConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/conffile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ OutputConfiguration

Returns a new instance of OutputConfiguration.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fluent/plugin/conffile.rb', line 21

def initialize(opts = {})
  # Initialize configuration options and logger
  @logger_path = opts[:logger_path]
  @logger = initialize_logger
  @client_app_id = opts[:client_app_id]
  @client_app_secret = opts[:client_app_secret]
  @tenant_id = opts[:tenant_id]
  @kusto_endpoint = opts[:kusto_endpoint]
  @database_name = opts[:database_name]
  @table_name = opts[:table_name]
  @azure_cloud = opts[:azure_cloud] || 'AzureCloud'
  @managed_identity_client_id = opts[:managed_identity_client_id]
  @azure_clouds = AZURE_CLOUDS
  @auth_type = opts[:auth_type] || 'aad'
  @workload_identity_client_id = opts[:workload_identity_client_id]
  @workload_identity_tenant_id = opts[:workload_identity_tenant_id]
  @workload_identity_token_file_path = opts[:workload_identity_token_file_path]
  validate_configuration
end

Instance Attribute Details

#auth_typeObject (readonly)

Returns the value of attribute auth_type.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def auth_type
  @auth_type
end

#azure_cloudObject (readonly)

Returns the value of attribute azure_cloud.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def azure_cloud
  @azure_cloud
end

#client_app_idObject (readonly)

Returns the value of attribute client_app_id.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def client_app_id
  @client_app_id
end

#client_app_secretObject (readonly)

Returns the value of attribute client_app_secret.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def client_app_secret
  @client_app_secret
end

#database_nameObject (readonly)

Returns the value of attribute database_name.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def database_name
  @database_name
end

#kusto_endpointObject (readonly)

Returns the value of attribute kusto_endpoint.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def kusto_endpoint
  @kusto_endpoint
end

#loggerObject (readonly)

Returns the value of attribute logger.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def logger
  @logger
end

#managed_identity_client_idObject (readonly)

Returns the value of attribute managed_identity_client_id.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def managed_identity_client_id
  @managed_identity_client_id
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def table_name
  @table_name
end

#tenant_idObject (readonly)

Returns the value of attribute tenant_id.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def tenant_id
  @tenant_id
end

#workload_identity_client_idObject (readonly)

Returns the value of attribute workload_identity_client_id.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def workload_identity_client_id
  @workload_identity_client_id
end

#workload_identity_tenant_idObject (readonly)

Returns the value of attribute workload_identity_tenant_id.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def workload_identity_tenant_id
  @workload_identity_tenant_id
end

#workload_identity_token_file_pathObject (readonly)

Returns the value of attribute workload_identity_token_file_path.



66
67
68
# File 'lib/fluent/plugin/conffile.rb', line 66

def workload_identity_token_file_path
  @workload_identity_token_file_path
end

Instance Method Details

#aad_endpointObject



70
71
72
73
# File 'lib/fluent/plugin/conffile.rb', line 70

def aad_endpoint
  # Return Azure AD endpoint for selected cloud
  @azure_clouds[@azure_cloud]['aad']
end

Raises:

  • (ArgumentError)


57
58
59
60
61
62
63
64
# File 'lib/fluent/plugin/conffile.rb', line 57

def print_missing_parameter_message_and_raise(param_name)
  # Print error and raise if a required parameter is missing
  @logger.error(
    "Missing a required setting for the Kusto output plugin configuration:\n" \
    "output {\nkusto {\n#{param_name} => # SETTING MISSING\n ...\n}\n}\n"
  )
  raise ArgumentError, "The setting #{param_name} is required for Kusto configuration."
end

#validate_configurationObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fluent/plugin/conffile.rb', line 41

def validate_configuration
  # Validate configuration based on authentication method
  case @auth_type&.downcase
  when 'aad'
    validate_aad_config
  when 'user_managed_identity', 'system_managed_identity', 'azcli'
    validate_base_config
  when 'workload_identity'
    validate_workload_identity_config
  else
    raise ArgumentError, "Unknown auth_type: #{@auth_type}"
  end
  validate_azure_cloud
  true
end