Skip to content

Commit 8c57387

Browse files
committed
Add AuthenticationClass::resolve (#432)
## Description *Please add a description here. This will become the commit message of the merge request later.*
1 parent d690140 commit 8c57387

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Added
8+
9+
- Add `AuthenticationClass::resolve` helper function ([#432]).
10+
11+
[#432]: https://github.com/stackabletech/operator-rs/pull/432
12+
713
## [0.22.0] - 2022-07-05
814

915
### Added

src/commons/authentication.rs

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
use serde::{Deserialize, Serialize};
2-
use strum::Display;
3-
4-
use crate::commons::{ldap::LdapAuthenticationProvider, tls::TlsAuthenticationProvider};
1+
use crate::{
2+
client::Client,
3+
commons::{ldap::LdapAuthenticationProvider, tls::TlsAuthenticationProvider},
4+
error::Error,
5+
};
56
use kube::CustomResource;
67
use schemars::JsonSchema;
8+
use serde::{Deserialize, Serialize};
9+
use strum::Display;
710

811
#[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
912
#[kube(
@@ -45,3 +48,14 @@ mod test {
4548
assert_eq!("Tls", tls_provider.to_string())
4649
}
4750
}
51+
52+
impl AuthenticationClass {
53+
pub async fn resolve(
54+
client: &Client,
55+
authentication_class_name: &str,
56+
) -> Result<AuthenticationClass, Error> {
57+
client
58+
.get::<AuthenticationClass>(authentication_class_name, None) // AuthenticationClass has ClusterScope
59+
.await
60+
}
61+
}

0 commit comments

Comments
 (0)