Ruby를 사용하여 워크플로 만들기

Ruby를 사용하여 워크플로를 만듭니다.

코드 샘플


이 샘플을 사용해 보기 전에 Workflows 빠른 시작: 클라이언트 라이브러리 사용의 C# 설정 안내를 따르세요. 자세한 내용은 Workflows C# API 참조 문서를 확인하세요.

using Google.Api.Gax.ResourceNames;
using Google.Cloud.Workflows.V1;
using Google.LongRunning;

public sealed partial class GeneratedWorkflowsClientSnippets
    /// <summary>Snippet for CreateWorkflow</summary>
    /// <remarks>
    /// This snippet has been automatically generated for illustrative purposes only.
    /// It may require modifications to work in your environment.
    /// </remarks>
    public void CreateWorkflowRequestObject()
        // Create client
        WorkflowsClient workflowsClient = WorkflowsClient.Create();
        // Initialize request argument(s)
        CreateWorkflowRequest request = new CreateWorkflowRequest
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            Workflow = new Workflow(),
            WorkflowId = "",
        // Make the request
        Operation<Workflow, OperationMetadata> response = workflowsClient.CreateWorkflow(request);

        // Poll until the returned long-running operation is complete
        Operation<Workflow, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        Workflow result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<Workflow, OperationMetadata> retrievedResponse = workflowsClient.PollOnceCreateWorkflow(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
            // If it has completed, then access the result
            Workflow retrievedResult = retrievedResponse.Result;


이 샘플을 시도해 보기 전에 Workflows 빠른 시작: 클라이언트 라이브러리 사용의 Python 설정 안내를 따르세요. 자세한 내용은 Workflows Python API 참조 문서를 확인하세요.

from import workflows_v1

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

    # Initialize request argument(s)
    workflow = workflows_v1.Workflow()
    workflow.source_contents = "source_contents_value"

    request = workflows_v1.CreateWorkflowRequest(

    # Make the request
    operation = client.create_workflow(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response


이 샘플을 사용해 보기 전에 Workflows 빠른 시작: 클라이언트 라이브러리 사용의 Ruby 설정 안내를 따르세요. 자세한 내용은 Workflows Ruby API 참조 문서를 확인하세요.

require "google/cloud/workflows/v1"

# Create a client object. The client can be reused for multiple calls.
client =

# Create a request. To set request fields, pass in keyword arguments.
request =

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

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
  puts "Error!"

다음 단계

다른 Google Cloud 제품의 코드 샘플을 검색하고 필터링하려면 Google Cloud 샘플 브라우저를 참조하세요.