View Source ExOciSdk.Config (ex_oci_sdk v0.2.1)
Provides configuration structure and validation for Oracle Cloud Infrastructure (OCI) credentials.
This module manages the configuration required for authenticating with OCI services, including user, tenancy information, and private key authentication.
Summary
Functions
Creates a new configuration from an OCI config file.
Creates a new configuration struct with the provided options.
Types
@type config_options() :: %{ user: String.t(), fingerprint: String.t(), tenancy: String.t(), region: String.t(), key_content: String.t() | nil, key_file: String.t() | nil }
Options for creating a new configuration.
Fields
user
- The OCID of the user making the requestfingerprint
- Fingerprint of the public key uploaded to OCItenancy
- The OCID of your tenancyregion
- The region of the OCI services being accessedkey_content
- The private key content as a string (mutually exclusive withkey_content_file
)key_content_file
- Path to the private key file (mutually exclusive withkey_content
)
@type t() :: %ExOciSdk.Config{ fingerprint: String.t(), key_content: String.t(), region: String.t(), tenancy: String.t(), user: String.t() }
Configuration structure for OCI authentication.
Fields
user
- The OCID of the user making the requestfingerprint
- Fingerprint of the public key uploaded to OCItenancy
- The OCID of your tenancyregion
- The region of the OCI services being accessedkey_content
- The private key content used for signing requests
Functions
Creates a new configuration from an OCI config file.
The function reads and parses an INI-formatted OCI configuration file and creates a new configuration struct based on the specified profile.
Parameters
config_file_path
- Path to the OCI config file. Defaults to "~/.oci/config"profile
- The profile name to use from the config file. Defaults to "DEFAULT"
Returns
t/0
- The configuration struct
Raises
ArgumentError
- If the config file cannot be parsed or if the specified profile is not found- All raises from new!/1
@spec new!(config_options()) :: t() | no_return()
@spec new!(config_options()) :: t() | no_return()
Creates a new configuration struct with the provided options.
This function accepts either direct key content or a path to a key file, but not both. The private key content will be validated to ensure it's in the correct PEM format.
Parameters
options
- Map containing configuration values. Seeconfig_options/0
for details.
Returns
t/0
- The configuration struct
Raises
ArgumentError
- If the key content is invalid or not in PEM formatFile.Error
- If the key file cannot be read (when usingkey_content_file
)