angreal.integrations.oci
Binding
OCI integration module, exposed as angreal.integrations.oci in Python.
Classes
Section titled “Classes”class Oci
Section titled “class Oci”Rust Implementation:
angreal::python_bindings::integrations::oci::PyOci
OCI registry client for angreal template artifacts.
Pull and push templates, list tags, and authenticate against registries.
Credentials set via login() are held for the lifetime of the instance and
take precedence over Docker config.json credentials for that registry.
Methods
Section titled “Methods”def new() -> SelfRust Implementation:
angreal::python_bindings::integrations::oci::PyOci::new
Source
fn new() -> Self { Self { credentials: Mutex::new(HashMap::new()), } }def login(registry: str, username: str, password: str) -> NoneRust Implementation:
angreal::python_bindings::integrations::oci::PyOci::login
Store Basic credentials for registry (e.g. ghcr.io), used by subsequent pull/push/tags calls against that registry.
Parameters:
| Name | Type | Description |
|---|---|---|
registry |
str |
|
username |
str |
|
password |
str |
Source
fn login(&self, registry: &str, username: String, password: String) -> PyResult<()> { self.credentials .lock() .expect("oci credentials mutex poisoned") .insert(registry.to_string(), OciAuth::Basic { username, password }); Ok(()) }def pull(reference: str, dest: Optional[PathBuf], insecure: bool) -> strRust Implementation:
angreal::python_bindings::integrations::oci::PyOci::pull
Pull a template artifact to dest (default: a directory named after the repository, under the current directory). Set insecure=True to pull from a plain-HTTP registry. Returns the destination path.
Parameters:
| Name | Type | Description |
|---|---|---|
reference |
str |
|
dest |
Optional[PathBuf] |
|
insecure |
bool |
Source
fn pull(&self, reference: &str, dest: Option<PathBuf>, insecure: bool) -> PyResult<String> { let dest = match dest { Some(d) => d, None => { let name = core::reference_basename(reference).map_err(to_pyerr)?; std::env::current_dir()?.join(name) } }; let auth = self.auth_for(reference); let out = Oci::pull_artifact(reference, &dest, &auth, insecure).map_err(to_pyerr)?; Ok(out.display().to_string()) }def push(reference: str, path: PathBuf, insecure: bool) -> NoneRust Implementation:
angreal::python_bindings::integrations::oci::PyOci::push
Package the directory at path as a template artifact and push it to reference. Set insecure=True to push to a plain-HTTP registry.
Parameters:
| Name | Type | Description |
|---|---|---|
reference |
str |
|
path |
PathBuf |
|
insecure |
bool |
Source
fn push(&self, reference: &str, path: PathBuf, insecure: bool) -> PyResult<()> { let auth = self.auth_for(reference); Oci::push_artifact(reference, &path, &auth, insecure).map_err(to_pyerr) }def tags(repository: str, insecure: bool) -> List[str]Rust Implementation:
angreal::python_bindings::integrations::oci::PyOci::tags
List the tags available for repository. Set insecure=True for a plain-HTTP registry.
Parameters:
| Name | Type | Description |
|---|---|---|
repository |
str |
|
insecure |
bool |
Source
fn tags(&self, repository: &str, insecure: bool) -> PyResult<Vec<String>> { let auth = self.auth_for(repository); Oci::list_tags(repository, &auth, insecure).map_err(to_pyerr) }