pub struct GitLab { /* private fields */ }Expand description
A GitLab client that resolves credentials from the workflow’s secret store.
Wraps AsyncGitlab and provides a convenience op method
to turn any endpoint into a tracked Operation.
§Examples
use ironflow_ops_gitlab::GitLab;
use ironflow_core::operation::{OperationContext, NoopSecretResolver};
use std::sync::Arc;
let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
// gitlab.com (default)
let gitlab = GitLab::from_context(&ctx).await?;
// Self-hosted
let gitlab = GitLab::from_context_with_host(&ctx, "gitlab.example.com").await?;Implementations§
Source§impl GitLab
impl GitLab
Sourcepub async fn from_context(
ctx: &OperationContext,
) -> Result<Self, OperationError>
pub async fn from_context( ctx: &OperationContext, ) -> Result<Self, OperationError>
Build a client from an OperationContext, defaulting to gitlab.com.
Reads the gitlab_token secret from the workflow’s secret store.
§Errors
Returns OperationError::Secret if the token is missing, or
OperationError::Http if the client cannot be built.
Sourcepub async fn from_context_with_host(
ctx: &OperationContext,
host: &str,
) -> Result<Self, OperationError>
pub async fn from_context_with_host( ctx: &OperationContext, host: &str, ) -> Result<Self, OperationError>
Build a client from an OperationContext with a custom host.
§Errors
Returns OperationError::Secret if the token is missing, or
OperationError::Http if the client cannot be built.
Sourcepub async fn new(token: &str, host: &str) -> Result<Self, OperationError>
pub async fn new(token: &str, host: &str) -> Result<Self, OperationError>
Build a client with an explicit token and host.
§Errors
Returns OperationError::Http if the client cannot be built.
§Examples
use ironflow_ops_gitlab::GitLab;
let gitlab = GitLab::new("glpat-xxxx", "gitlab.com").await?;Sourcepub fn client(&self) -> &AsyncGitlab
pub fn client(&self) -> &AsyncGitlab
The underlying AsyncGitlab client.
Use this with AsyncQuery::query_async
for typed endpoint calls.
Sourcepub fn op<E>(&self, endpoint: E) -> GitLabOp<E>
pub fn op<E>(&self, endpoint: E) -> GitLabOp<E>
Wrap an endpoint as a tracked Operation.
The returned GitLabOp implements Operation so it can be passed
to WorkflowContext::operation() for step lifecycle tracking.
§Examples
use ironflow_ops_gitlab::GitLab;
use gitlab::api::projects;
let gitlab = GitLab::new("glpat-xxxx", "gitlab.com").await?;
let endpoint = projects::Project::builder().project(42).build().unwrap();
let op = gitlab.op(endpoint);Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GitLab
impl !UnwindSafe for GitLab
impl Freeze for GitLab
impl Send for GitLab
impl Sync for GitLab
impl Unpin for GitLab
impl UnsafeUnpin for GitLab
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more