Skip to main content

GcloudClient

Struct GcloudClient 

Source
pub struct GcloudClient<E: GcloudExecutor = RealExecutor> { /* private fields */ }
Expand description

GCP operations client, parameterized over the executor for testability.

Implementations§

Source§

impl GcloudClient<RealExecutor>

Source

pub fn new() -> Self

Source§

impl<E: GcloudExecutor> GcloudClient<E>

Source

pub fn with_executor(executor: E) -> Self

Source

pub async fn check_prerequisites( &self, project_id: &str, ) -> Result<PreflightReport, PreflightError>

Source

pub async fn doctor(&self, project_id: Option<&str>) -> DoctorReport

Run all diagnostic checks without early return. Returns a report with pass/fail for each check item.

Source

pub async fn ensure_artifact_repo( &self, project_id: &str, region: &str, repo_name: &str, ) -> Result<(), DeployError>

Ensure the Artifact Registry Docker repository exists, creating it if needed.

Source

pub async fn delete_image( &self, image_tag: &str, project_id: &str, ) -> Result<(), DeployError>

Delete a container image from Artifact Registry.

Source

pub async fn submit_build( &self, bundle_dir: &Path, project_id: &str, image_tag: &str, ) -> Result<(), CloudBuildError>

Source

pub async fn deploy_to_cloud_run( &self, service_name: &str, image_tag: &str, project_id: &str, region: &str, config: &CloudRunConfig, secrets: &[String], ) -> Result<String, DeployError>

Source

pub async fn describe_service( &self, service_name: &str, project_id: &str, region: &str, ) -> Result<String, DeployError>

Source

pub async fn delete_service( &self, service_name: &str, project_id: &str, region: &str, ) -> Result<(), DeployError>

Source

pub async fn read_logs( &self, service_name: &str, project_id: &str, region: &str, limit: u32, ) -> Result<(), DeployError>

Source

pub async fn tail_logs( &self, service_name: &str, project_id: &str, region: &str, ) -> Result<(), DeployError>

Source

pub async fn set_secret( &self, project_id: &str, secret_name: &str, secret_value: &str, ) -> Result<(), SecretError>

Source

pub async fn get_project_number( &self, project_id: &str, ) -> Result<String, DeployError>

Source

pub async fn grant_secret_access( &self, project_id: &str, secret_name: &str, service_account: &str, ) -> Result<(), SecretError>

Source

pub async fn revoke_secret_access( &self, project_id: &str, secret_name: &str, service_account: &str, ) -> Result<(), SecretError>

Source

pub async fn list_secrets( &self, project_id: &str, ) -> Result<Vec<String>, SecretError>

Source

pub async fn delete_secret( &self, project_id: &str, secret_name: &str, ) -> Result<(), SecretError>

Source

pub async fn ensure_wif_pool( &self, project_id: &str, pool_id: &str, ) -> Result<bool, WifError>

Create a Workload Identity Pool (idempotent). Returns true if created, false if already existed.

Source

pub async fn ensure_oidc_provider( &self, project_id: &str, pool_id: &str, provider_id: &str, github_repo: &str, ) -> Result<bool, WifError>

Create an OIDC provider in a WIF pool (idempotent). Returns true if created, false if already existed.

Source

pub async fn ensure_service_account( &self, project_id: &str, sa_id: &str, display_name: &str, ) -> Result<bool, WifError>

Create a service account (idempotent). Returns true if created, false if already existed.

Source

pub async fn bind_iam_roles( &self, project_id: &str, sa_email: &str, roles: &[&str], ) -> Result<(), WifError>

Bind IAM roles to a service account.

Source

pub async fn bind_wif_to_sa( &self, project_id: &str, project_number: &str, pool_id: &str, sa_email: &str, github_repo: &str, ) -> Result<(), WifError>

Bind a WIF pool to a service account, scoped to a GitHub repository.

Source

pub async fn delete_wif_pool( &self, project_id: &str, pool_id: &str, ) -> Result<(), WifError>

Delete a Workload Identity Pool (and its providers).

Source

pub async fn delete_service_account( &self, project_id: &str, sa_email: &str, ) -> Result<(), WifError>

Delete a service account.

Trait Implementations§

Source§

impl Default for GcloudClient<RealExecutor>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<E> Freeze for GcloudClient<E>
where E: Freeze,

§

impl<E> RefUnwindSafe for GcloudClient<E>
where E: RefUnwindSafe,

§

impl<E> Send for GcloudClient<E>

§

impl<E> Sync for GcloudClient<E>

§

impl<E> Unpin for GcloudClient<E>
where E: Unpin,

§

impl<E> UnsafeUnpin for GcloudClient<E>
where E: UnsafeUnpin,

§

impl<E> UnwindSafe for GcloudClient<E>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more