/// <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 CancelTrainingPipelineAsync</summary> public async Task CancelTrainingPipelineRequestObjectAsync() { // Snippet: CancelTrainingPipelineAsync(CancelTrainingPipelineRequest, CallSettings) // Additional: CancelTrainingPipelineAsync(CancelTrainingPipelineRequest, CancellationToken) // Create client PipelineServiceClient pipelineServiceClient = await PipelineServiceClient.CreateAsync(); // Initialize request argument(s) CancelTrainingPipelineRequest request = new CancelTrainingPipelineRequest { TrainingPipelineName = TrainingPipelineName.FromProjectLocationTrainingPipeline("[PROJECT]", "[LOCATION]", "[TRAINING_PIPELINE]"), }; // Make the request await pipelineServiceClient.CancelTrainingPipelineAsync(request); // End snippet }
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(); }