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);Sourcepub fn paged_op<E>(
&self,
endpoint: E,
pagination: Pagination,
) -> GitLabPagedOp<E>
pub fn paged_op<E>( &self, endpoint: E, pagination: Pagination, ) -> GitLabPagedOp<E>
Wrap a pageable endpoint as a tracked Operation
that fetches every page requested by pagination and concatenates the results.
Unlike GitLab::op, this accepts endpoints that implement
Pageable (e.g. any “list …” endpoint) and drives
pagination itself, so a single tracked step can retrieve more than one page
(GitLabOp only ever issues a single request and therefore only ever returns
the first page).
§Examples
use ironflow_ops_gitlab::GitLab;
use gitlab::api::projects::merge_requests::MergeRequests;
use gitlab::api::Pagination;
let gitlab = GitLab::new("glpat-xxxx", "gitlab.com").await?;
let endpoint = MergeRequests::builder().project(42).build().unwrap();
let op = gitlab.paged_op(endpoint, Pagination::All);Trait Implementations§
Source§impl From<AsyncGitlab> for GitLab
Build a GitLab client from an already configured AsyncGitlab.
impl From<AsyncGitlab> for GitLab
Build a GitLab client from an already configured AsyncGitlab.
Use this when GitLab::new is not flexible enough – for example to
point the client at an HTTP test double (wiremock) or a self-hosted
instance with custom TLS settings, by building the client directly via
GitlabBuilder and converting the result.
§Examples
use ironflow_ops_gitlab::GitLab;
use gitlab::GitlabBuilder;
// `.insecure()` allows plain HTTP, e.g. against a wiremock server in tests.
let client = GitlabBuilder::new("gitlab.example.com", "glpat-xxxx")
.insecure()
.build_async()
.await?;
let gitlab: GitLab = client.into();Source§fn from(inner: AsyncGitlab) -> Self
fn from(inner: AsyncGitlab) -> Self
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