/// <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 DeleteTrainingPipeline</summary> public void DeleteTrainingPipelineRequestObject() { // Snippet: DeleteTrainingPipeline(DeleteTrainingPipelineRequest, CallSettings) // Create client PipelineServiceClient pipelineServiceClient = PipelineServiceClient.Create(); // Initialize request argument(s) DeleteTrainingPipelineRequest request = new DeleteTrainingPipelineRequest { TrainingPipelineName = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"), }; // Make the request Operation <Empty, DeleteOperationMetadata> response = pipelineServiceClient.DeleteTrainingPipeline(request); // Poll until the returned long-running operation is complete Operation <Empty, DeleteOperationMetadata> completedResponse = response.PollUntilCompleted(); // 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 = pipelineServiceClient.PollOnceDeleteTrainingPipeline(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 GetTrainingPipeline</summary> public void GetTrainingPipelineResourceNames() { // Snippet: GetTrainingPipeline(TrainingPipelineName, CallSettings) // Create client PipelineServiceClient pipelineServiceClient = PipelineServiceClient.Create(); // Initialize request argument(s) TrainingPipelineName name = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"); // Make the request TrainingPipeline response = pipelineServiceClient.GetTrainingPipeline(name); // 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 CancelTrainingPipeline</summary> public void CancelTrainingPipelineRequestObject() { // Snippet: CancelTrainingPipeline(CancelTrainingPipelineRequest, CallSettings) // Create client PipelineServiceClient pipelineServiceClient = PipelineServiceClient.Create(); // Initialize request argument(s) CancelTrainingPipelineRequest request = new CancelTrainingPipelineRequest { TrainingPipelineName = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"), }; // Make the request pipelineServiceClient.CancelTrainingPipeline(request); // 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 }
public async stt::Task CreateTrainingPipelineRequestObjectAsync() { moq::Mock <PipelineService.PipelineServiceClient> mockGrpcClient = new moq::Mock <PipelineService.PipelineServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CreateTrainingPipelineRequest request = new CreateTrainingPipelineRequest { ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), TrainingPipeline = new TrainingPipeline(), }; TrainingPipeline expectedResponse = new TrainingPipeline { TrainingPipelineName = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"), DisplayName = "display_name137f65c2", InputDataConfig = new InputDataConfig(), TrainingTaskDefinition = "training_task_definition3e3456be", TrainingTaskInputs = new wkt::Value(), TrainingTaskMetadata = new wkt::Value(), ModelToUpload = new Model(), State = PipelineState.Running, Error = new gr::Status(), CreateTime = new wkt::Timestamp(), StartTime = new wkt::Timestamp(), EndTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, EncryptionSpec = new EncryptionSpec(), }; mockGrpcClient.Setup(x => x.CreateTrainingPipelineAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TrainingPipeline>(stt::Task.FromResult(expectedResponse), null, null, null, null)); PipelineServiceClient client = new PipelineServiceClientImpl(mockGrpcClient.Object, null); TrainingPipeline responseCallSettings = await client.CreateTrainingPipelineAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); TrainingPipeline responseCancellationToken = await client.CreateTrainingPipelineAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void CancelTrainingPipelineResourceNames() { moq::Mock <PipelineService.PipelineServiceClient> mockGrpcClient = new moq::Mock <PipelineService.PipelineServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CancelTrainingPipelineRequest request = new CancelTrainingPipelineRequest { TrainingPipelineName = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.CancelTrainingPipeline(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); PipelineServiceClient client = new PipelineServiceClientImpl(mockGrpcClient.Object, null); client.CancelTrainingPipeline(request.TrainingPipelineName); mockGrpcClient.VerifyAll(); }
public async stt::Task CancelTrainingPipelineResourceNamesAsync() { moq::Mock <PipelineService.PipelineServiceClient> mockGrpcClient = new moq::Mock <PipelineService.PipelineServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CancelTrainingPipelineRequest request = new CancelTrainingPipelineRequest { TrainingPipelineName = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.CancelTrainingPipelineAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); PipelineServiceClient client = new PipelineServiceClientImpl(mockGrpcClient.Object, null); await client.CancelTrainingPipelineAsync(request.TrainingPipelineName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.CancelTrainingPipelineAsync(request.TrainingPipelineName, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
public void GetTrainingPipelineResourceNames() { moq::Mock <PipelineService.PipelineServiceClient> mockGrpcClient = new moq::Mock <PipelineService.PipelineServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetTrainingPipelineRequest request = new GetTrainingPipelineRequest { TrainingPipelineName = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"), }; TrainingPipeline expectedResponse = new TrainingPipeline { TrainingPipelineName = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"), DisplayName = "display_name137f65c2", InputDataConfig = new InputDataConfig(), TrainingTaskDefinition = "training_task_definition3e3456be", TrainingTaskInputs = new wkt::Value(), TrainingTaskMetadata = new wkt::Value(), ModelToUpload = new Model(), State = PipelineState.Running, Error = new gr::Status(), CreateTime = new wkt::Timestamp(), StartTime = new wkt::Timestamp(), EndTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, EncryptionSpec = new EncryptionSpec(), }; mockGrpcClient.Setup(x => x.GetTrainingPipeline(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); PipelineServiceClient client = new PipelineServiceClientImpl(mockGrpcClient.Object, null); TrainingPipeline response = client.GetTrainingPipeline(request.TrainingPipelineName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }