Obtenir l'état d'une tâche

Restez organisé à l'aide des collections Enregistrez et classez les contenus selon vos préférences.

Explique comment obtenir l'état d'une tâche.

Exemple de code

C#

using Google.Cloud.Dataflow.V1Beta3;

public sealed partial class GeneratedJobsV1Beta3ClientSnippets
{
    /// <summary>Snippet for GetJob</summary>
    /// <remarks>
    /// This snippet has been automatically generated for illustrative purposes only.
    /// It may require modifications to work in your environment.
    /// </remarks>
    public void GetJobRequestObject()
    {
        // Create client
        JobsV1Beta3Client jobsV1Beta3Client = JobsV1Beta3Client.Create();
        // Initialize request argument(s)
        GetJobRequest request = new GetJobRequest
        {
            ProjectId = "",
            JobId = "",
            View = JobView.Unknown,
            Location = "",
        };
        // Make the request
        Job response = jobsV1Beta3Client.GetJob(request);
    }
}

Go


package main

import (
	"context"

	dataflow "cloud.google.com/go/dataflow/apiv1beta3"
	"cloud.google.com/go/dataflow/apiv1beta3/dataflowpb"
)

func main() {
	ctx := context.Background()
	// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataflow.NewJobsV1Beta3Client(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataflowpb.GetJobRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataflow/apiv1beta3/dataflowpb#GetJobRequest.
	}
	resp, err := c.GetJob(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Étape suivante

Pour rechercher et filtrer des exemples de code pour d'autres produits Google Cloud, consultez l'explorateur d'exemples Google Cloud.