Exemple #1
0
        /// <summary>Snippet for SubmitJobAsOperation</summary>
        public void SubmitJobAsOperation()
        {
            // Snippet: SubmitJobAsOperation(string, string, Job, CallSettings)
            // Create client
            JobControllerClient jobControllerClient = JobControllerClient.Create();
            // Initialize request argument(s)
            string projectId = "";
            string region    = "";
            Job    job       = new Job();
            // Make the request
            Operation <Job, JobMetadata> response = jobControllerClient.SubmitJobAsOperation(projectId, region, job);

            // Poll until the returned long-running operation is complete
            Operation <Job, JobMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Job 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 <Job, JobMetadata> retrievedResponse = jobControllerClient.PollOnceSubmitJobAsOperation(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Job retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }