pub struct CloudBuild { /* private fields */ }Expand description
Implements a client for the Cloud Build API.
§Example
let client = CloudBuild::builder().build().await?;
// use `client` to make requests to the Cloud Build API.§Service Description
Creates and manages builds on Google Cloud Platform.
The main concept used by this API is a Build, which describes the location
of the source to build, how to build the source, and where to store the
built artifacts, if any.
A user can list previously-requested builds or get builds by their ID to determine the status of the build.
§Configuration
To configure CloudBuild use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://cloudbuild.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
CloudBuild holds a connection pool internally, it is advised to
create one and the reuse it. You do not need to wrap CloudBuild in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl CloudBuild
impl CloudBuild
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for CloudBuild.
let client = CloudBuild::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: CloudBuild + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: CloudBuild + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn create_build(&self) -> CreateBuild
pub fn create_build(&self) -> CreateBuild
Starts a build with the specified configuration.
This method returns a long-running Operation, which includes the build
ID. Pass the build ID to GetBuild to determine the build status (such as
SUCCESS or FAILURE).
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn get_build(&self) -> GetBuild
pub fn get_build(&self) -> GetBuild
Returns information about a previously requested build.
The Build that is returned includes its status (such as SUCCESS,
FAILURE, or WORKING), and timing information.
Sourcepub fn list_builds(&self) -> ListBuilds
pub fn list_builds(&self) -> ListBuilds
Lists previously requested builds.
Previously requested builds may still be in-progress, or may have finished successfully or unsuccessfully.
Sourcepub fn cancel_build(&self) -> CancelBuild
pub fn cancel_build(&self) -> CancelBuild
Cancels a build in progress.
Sourcepub fn retry_build(&self) -> RetryBuild
pub fn retry_build(&self) -> RetryBuild
Creates a new build based on the specified build.
This method creates a new build using the original build request, which may or may not result in an identical build.
For triggered builds:
- Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision.
For non-triggered builds that specify RepoSource:
- If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build.
- If the original build specified a commit sha or revision ID, the retried build will use the identical source.
For builds that specify StorageSource:
- If the original build pulled source from Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source.
- If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket’s lifecycle management settings.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn approve_build(&self) -> ApproveBuild
pub fn approve_build(&self) -> ApproveBuild
Approves or rejects a pending build.
If approved, the returned long-running operation (LRO) will be analogous to the LRO returned from a CreateBuild call.
If rejected, the returned LRO will be immediately done.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn create_build_trigger(&self) -> CreateBuildTrigger
pub fn create_build_trigger(&self) -> CreateBuildTrigger
Creates a new BuildTrigger.
Sourcepub fn get_build_trigger(&self) -> GetBuildTrigger
pub fn get_build_trigger(&self) -> GetBuildTrigger
Returns information about a BuildTrigger.
Sourcepub fn list_build_triggers(&self) -> ListBuildTriggers
pub fn list_build_triggers(&self) -> ListBuildTriggers
Lists existing BuildTriggers.
Sourcepub fn delete_build_trigger(&self) -> DeleteBuildTrigger
pub fn delete_build_trigger(&self) -> DeleteBuildTrigger
Deletes a BuildTrigger by its project ID and trigger ID.
Sourcepub fn update_build_trigger(&self) -> UpdateBuildTrigger
pub fn update_build_trigger(&self) -> UpdateBuildTrigger
Updates a BuildTrigger by its project ID and trigger ID.
Sourcepub fn run_build_trigger(&self) -> RunBuildTrigger
pub fn run_build_trigger(&self) -> RunBuildTrigger
Runs a BuildTrigger at a particular source revision.
To run a regional or global trigger, use the POST request that includes the location endpoint in the path (ex. v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The POST request that does not include the location endpoint in the path can only be used when running global triggers.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn receive_trigger_webhook(&self) -> ReceiveTriggerWebhook
pub fn receive_trigger_webhook(&self) -> ReceiveTriggerWebhook
ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger.
Sourcepub fn create_worker_pool(&self) -> CreateWorkerPool
pub fn create_worker_pool(&self) -> CreateWorkerPool
Creates a WorkerPool.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn get_worker_pool(&self) -> GetWorkerPool
pub fn get_worker_pool(&self) -> GetWorkerPool
Returns details of a WorkerPool.
Sourcepub fn delete_worker_pool(&self) -> DeleteWorkerPool
pub fn delete_worker_pool(&self) -> DeleteWorkerPool
Deletes a WorkerPool.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn update_worker_pool(&self) -> UpdateWorkerPool
pub fn update_worker_pool(&self) -> UpdateWorkerPool
Updates a WorkerPool.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
Sourcepub fn list_worker_pools(&self) -> ListWorkerPools
pub fn list_worker_pools(&self) -> ListWorkerPools
Lists WorkerPools.
Sourcepub fn get_default_service_account(&self) -> GetDefaultServiceAccount
pub fn get_default_service_account(&self) -> GetDefaultServiceAccount
Returns the DefaultServiceAccount used by the project.
Sourcepub fn get_operation(&self) -> GetOperation
pub fn get_operation(&self) -> GetOperation
Provides the Operations service functionality in this service.
Sourcepub fn cancel_operation(&self) -> CancelOperation
pub fn cancel_operation(&self) -> CancelOperation
Provides the Operations service functionality in this service.
Trait Implementations§
Source§impl Clone for CloudBuild
impl Clone for CloudBuild
Source§fn clone(&self) -> CloudBuild
fn clone(&self) -> CloudBuild
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more