Get a workflow using Python or Ruby.

Stay organized with collections Save and categorize content based on your preferences.

Gets a workflow using Python or Ruby.

Code sample

C#

Before trying this sample, follow the C# setup instructions in the Workflows quickstart using client libraries. For more information, see the Workflows C# API reference documentation.

using Google.Cloud.Workflows.Common.V1;
using Google.Cloud.Workflows.V1;

public sealed partial class GeneratedWorkflowsClientSnippets
{
    /// <summary>Snippet for GetWorkflow</summary>
    /// <remarks>
    /// This snippet has been automatically generated for illustrative purposes only.
    /// It may require modifications to work in your environment.
    /// </remarks>
    public void GetWorkflowRequestObject()
    {
        // Create client
        WorkflowsClient workflowsClient = WorkflowsClient.Create();
        // Initialize request argument(s)
        GetWorkflowRequest request = new GetWorkflowRequest
        {
            WorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
        };
        // Make the request
        Workflow response = workflowsClient.GetWorkflow(request);
    }
}

Python

Before trying this sample, follow the Python setup instructions in the Workflows quickstart using client libraries. For more information, see the Workflows Python API reference documentation.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import workflows_v1


def sample_get_workflow():
    # Create a client
    client = workflows_v1.WorkflowsClient()

    # Initialize request argument(s)
    request = workflows_v1.GetWorkflowRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_workflow(request=request)

    # Handle the response
    print(response)

Ruby

Before trying this sample, follow the Ruby setup instructions in the Workflows quickstart using client libraries. For more information, see the Workflows Ruby API reference documentation.

require "google/cloud/workflows/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Workflows::V1::Workflows::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Workflows::V1::GetWorkflowRequest.new

# Call the get_workflow method.
result = client.get_workflow request

# The returned object is of type Google::Cloud::Workflows::V1::Workflow.
p result

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.