/// <summary>Snippet for DeleteTrainingPipelineAsync</summary> public async Task DeleteTrainingPipelineResourceNamesAsync() { // Snippet: DeleteTrainingPipelineAsync(TrainingPipelineName, CallSettings) // Additional: DeleteTrainingPipelineAsync(TrainingPipelineName, CancellationToken) // Create client PipelineServiceClient pipelineServiceClient = await PipelineServiceClient.CreateAsync(); // Initialize request argument(s) TrainingPipelineName name = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"); // Make the request Operation <Empty, DeleteOperationMetadata> response = await pipelineServiceClient.DeleteTrainingPipelineAsync(name); // Poll until the returned long-running operation is complete Operation <Empty, DeleteOperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Empty 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 <Empty, DeleteOperationMetadata> retrievedResponse = await pipelineServiceClient.PollOnceDeleteTrainingPipelineAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Empty retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for CancelTrainingPipelineAsync</summary> public async Task CancelTrainingPipelineResourceNamesAsync() { // Snippet: CancelTrainingPipelineAsync(TrainingPipelineName, CallSettings) // Additional: CancelTrainingPipelineAsync(TrainingPipelineName, CancellationToken) // Create client PipelineServiceClient pipelineServiceClient = await PipelineServiceClient.CreateAsync(); // Initialize request argument(s) TrainingPipelineName name = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"); // Make the request await pipelineServiceClient.CancelTrainingPipelineAsync(name); // End snippet }
/// <summary>Snippet for CancelTrainingPipelineAsync</summary> public async Task CancelTrainingPipelineAsync() { // Snippet: CancelTrainingPipelineAsync(string, CallSettings) // Additional: CancelTrainingPipelineAsync(string, CancellationToken) // Create client PipelineServiceClient pipelineServiceClient = await PipelineServiceClient.CreateAsync(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/trainingPipelines/[TRAINING_PIPELINE]"; // Make the request await pipelineServiceClient.CancelTrainingPipelineAsync(name); // End snippet }
/// <summary>Snippet for ListTrainingPipelinesAsync</summary> public async Task ListTrainingPipelinesRequestObjectAsync() { // Snippet: ListTrainingPipelinesAsync(ListTrainingPipelinesRequest, CallSettings) // Create client PipelineServiceClient pipelineServiceClient = await PipelineServiceClient.CreateAsync(); // Initialize request argument(s) ListTrainingPipelinesRequest request = new ListTrainingPipelinesRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), Filter = "", ReadMask = new FieldMask(), }; // Make the request PagedAsyncEnumerable <ListTrainingPipelinesResponse, TrainingPipeline> response = pipelineServiceClient.ListTrainingPipelinesAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((TrainingPipeline item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListTrainingPipelinesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (TrainingPipeline item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <TrainingPipeline> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (TrainingPipeline item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for CreateTrainingPipelineAsync</summary> public async Task CreateTrainingPipelineAsync() { // Snippet: CreateTrainingPipelineAsync(string, TrainingPipeline, CallSettings) // Additional: CreateTrainingPipelineAsync(string, TrainingPipeline, CancellationToken) // Create client PipelineServiceClient pipelineServiceClient = await PipelineServiceClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]"; TrainingPipeline trainingPipeline = new TrainingPipeline(); // Make the request TrainingPipeline response = await pipelineServiceClient.CreateTrainingPipelineAsync(parent, trainingPipeline); // End snippet }
/// <summary>Snippet for CreateTrainingPipelineAsync</summary> public async Task CreateTrainingPipelineResourceNamesAsync() { // Snippet: CreateTrainingPipelineAsync(LocationName, TrainingPipeline, CallSettings) // Additional: CreateTrainingPipelineAsync(LocationName, TrainingPipeline, CancellationToken) // Create client PipelineServiceClient pipelineServiceClient = await PipelineServiceClient.CreateAsync(); // Initialize request argument(s) LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"); TrainingPipeline trainingPipeline = new TrainingPipeline(); // Make the request TrainingPipeline response = await pipelineServiceClient.CreateTrainingPipelineAsync(parent, trainingPipeline); // End snippet }
/// <summary>Snippet for GetTrainingPipelineAsync</summary> public async Task GetTrainingPipelineRequestObjectAsync() { // Snippet: GetTrainingPipelineAsync(GetTrainingPipelineRequest, CallSettings) // Additional: GetTrainingPipelineAsync(GetTrainingPipelineRequest, CancellationToken) // Create client PipelineServiceClient pipelineServiceClient = await PipelineServiceClient.CreateAsync(); // Initialize request argument(s) GetTrainingPipelineRequest request = new GetTrainingPipelineRequest { TrainingPipelineName = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"), }; // Make the request TrainingPipeline response = await pipelineServiceClient.GetTrainingPipelineAsync(request); // End snippet }
/// <summary>Snippet for CreateTrainingPipelineAsync</summary> public async Task CreateTrainingPipelineRequestObjectAsync() { // Snippet: CreateTrainingPipelineAsync(CreateTrainingPipelineRequest, CallSettings) // Additional: CreateTrainingPipelineAsync(CreateTrainingPipelineRequest, CancellationToken) // Create client PipelineServiceClient pipelineServiceClient = await PipelineServiceClient.CreateAsync(); // Initialize request argument(s) CreateTrainingPipelineRequest request = new CreateTrainingPipelineRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), TrainingPipeline = new TrainingPipeline(), }; // Make the request TrainingPipeline response = await pipelineServiceClient.CreateTrainingPipelineAsync(request); // End snippet }