pub struct Workflows { /* private fields */ }Expand description
Implements a client for the Workflows API.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
let client = Workflows::builder().build().await?;
let parent = "parent_value";
let mut list = client.list_workflows()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}§Service Description
Workflows is used to deploy and execute workflow programs. Workflows makes sure the program executes reliably, despite hardware and networking interruptions.
§Configuration
To configure Workflows 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://workflows.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
Workflows holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap Workflows in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl Workflows
impl Workflows
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for Workflows.
let client = Workflows::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: Workflows + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: Workflows + '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 list_workflows(&self) -> ListWorkflows
pub fn list_workflows(&self) -> ListWorkflows
Lists workflows in a given project and location. The default order is not specified.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows, parent: &str
) -> Result<()> {
let mut list = client.list_workflows()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_workflow(&self) -> GetWorkflow
pub fn get_workflow(&self) -> GetWorkflow
Gets details of a single workflow.
§Example
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows, name: &str
) -> Result<()> {
let response = client.get_workflow()
.set_name(name)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn create_workflow(&self) -> CreateWorkflow
pub fn create_workflow(&self) -> CreateWorkflow
Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
§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.
§Example
use google_cloud_lro::Poller;
use google_cloud_workflows_v1::model::Workflow;
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows, parent: &str
) -> Result<()> {
let response = client.create_workflow()
.set_parent(parent)
.set_workflow_id("workflow_id_value")
.set_workflow(
Workflow::new()/* set fields */
)
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_workflow(&self) -> DeleteWorkflow
pub fn delete_workflow(&self) -> DeleteWorkflow
Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.
§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.
§Example
use google_cloud_lro::Poller;
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows, name: &str
) -> Result<()> {
client.delete_workflow()
.set_name(name)
.poller().until_done().await?;
Ok(())
}Sourcepub fn update_workflow(&self) -> UpdateWorkflow
pub fn update_workflow(&self) -> UpdateWorkflow
Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.
§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.
§Example
use google_cloud_lro::Poller;
use google_cloud_wkt::FieldMask;
use google_cloud_workflows_v1::model::Workflow;
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows, name: &str
) -> Result<()> {
let response = client.update_workflow()
.set_workflow(
Workflow::new().set_name(name)/* set fields */
)
.set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_workflow_revisions(&self) -> ListWorkflowRevisions
pub fn list_workflow_revisions(&self) -> ListWorkflowRevisions
Lists revisions for a given workflow.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows
) -> Result<()> {
let mut list = client.list_workflow_revisions()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn list_locations(&self) -> ListLocations
pub fn list_locations(&self) -> ListLocations
Lists information about the supported locations for this service.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows
) -> Result<()> {
let mut list = client.list_locations()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_location(&self) -> GetLocation
pub fn get_location(&self) -> GetLocation
Gets information about a location.
§Example
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows
) -> Result<()> {
let response = client.get_location()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_operations(&self) -> ListOperations
pub fn list_operations(&self) -> ListOperations
Provides the Operations service functionality in this service.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows
) -> Result<()> {
let mut list = client.list_operations()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_operation(&self) -> GetOperation
pub fn get_operation(&self) -> GetOperation
Provides the Operations service functionality in this service.
§Example
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows
) -> Result<()> {
let response = client.get_operation()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_operation(&self) -> DeleteOperation
pub fn delete_operation(&self) -> DeleteOperation
Provides the Operations service functionality in this service.
§Example
use google_cloud_workflows_v1::Result;
async fn sample(
client: &Workflows
) -> Result<()> {
client.delete_operation()
/* set fields */
.send().await?;
Ok(())
}