#config-file #oci #cloud #oracle #infrastructure #parser #write

oci_cfg

A small library for parsing and writing OCI configuration files

1 unstable release

0.2.0 Feb 13, 2024

#321 in Authentication

MIT license

26KB
528 lines

OCI Config Writer

This small library enables engineers to create an Oracle Cloud Infrastructure (OCI) config file in Rust. It checks, whether a file already exists, before it writes the config into the sub-directory within the user's home. It checks the permissions before adding content. To instantiate the library it should be addressed as oci_cfg, this name is used within the modules. Documentation created using the make doc command.

More information about the config file itself can be found in the official documentation under: https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm

Example

use oci_cfg::{profile, credentials, report};

fn main() {
   profile(
    "ocid1.user.oc1..aaaaaaaaxxxxxx",
    "ocid1.fingerprint.oc1..aaaaaaaaxxxxxx",
    "path/to/private/key",
    "ocid1.tenancy.oc1..aaaaaaaaxxxxxx",
    "IAD"
   );
   credentials(
    "ocid1.user.oc1..aaaaaaaaxxxxxx",
    "ocid1.fingerprint.oc1..aaaaaaaaxxxxxx",
    "path/to/private/key",
    "passphrase"
   );
   content();
}

Dependencies

~0–10MB
~61K SLoC