protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCILoggingLog", "Remove")) { return; } DeleteLogRequest request; try { request = new DeleteLogRequest { LogGroupId = LogGroupId, LogId = LogId, IfMatch = IfMatch, OpcRequestId = OpcRequestId }; response = client.DeleteLog(request).GetAwaiter().GetResult(); WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary>Snippet for DeleteLog</summary> public void DeleteLog_RequestObject() { // Snippet: DeleteLog(DeleteLogRequest,CallSettings) // Create client LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create(); // Initialize request argument(s) DeleteLogRequest request = new DeleteLogRequest { LogNameAsLogNameOneof = LogNameOneof.From(new LogName("[PROJECT]", "[LOG]")), }; // Make the request loggingServiceV2Client.DeleteLog(request); // End snippet }
public void DeleteLog() { moq::Mock <LoggingServiceV2.LoggingServiceV2Client> mockGrpcClient = new moq::Mock <LoggingServiceV2.LoggingServiceV2Client>(moq::MockBehavior.Strict); DeleteLogRequest request = new DeleteLogRequest { LogNameAsLogName = LogName.FromProjectLog("[PROJECT]", "[LOG]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteLog(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); LoggingServiceV2Client client = new LoggingServiceV2ClientImpl(mockGrpcClient.Object, null); client.DeleteLog(request.LogName); mockGrpcClient.VerifyAll(); }
public async Task DeleteLogAsync2() { Mock <LoggingServiceV2.LoggingServiceV2Client> mockGrpcClient = new Mock <LoggingServiceV2.LoggingServiceV2Client>(MockBehavior.Strict); DeleteLogRequest request = new DeleteLogRequest { LogNameAsLogNameOneof = LogNameOneof.From(new LogName("[PROJECT]", "[LOG]")), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteLogAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); LoggingServiceV2Client client = new LoggingServiceV2ClientImpl(mockGrpcClient.Object, null); await client.DeleteLogAsync(request); mockGrpcClient.VerifyAll(); }
public void DeleteLog2() { Mock <LoggingServiceV2.LoggingServiceV2Client> mockGrpcClient = new Mock <LoggingServiceV2.LoggingServiceV2Client>(MockBehavior.Strict); DeleteLogRequest request = new DeleteLogRequest { LogNameAsLogNameOneof = LogNameOneof.From(new LogName("[PROJECT]", "[LOG]")), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteLog(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); LoggingServiceV2Client client = new LoggingServiceV2ClientImpl(mockGrpcClient.Object, null); client.DeleteLog(request); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for DeleteLogAsync</summary> public async Task DeleteLogAsync_RequestObject() { // Snippet: DeleteLogAsync(DeleteLogRequest,CallSettings) // Additional: DeleteLogAsync(DeleteLogRequest,CancellationToken) // Create client LoggingServiceV2Client loggingServiceV2Client = await LoggingServiceV2Client.CreateAsync(); // Initialize request argument(s) DeleteLogRequest request = new DeleteLogRequest { LogNameAsLogNameOneof = LogNameOneof.From(new LogName("[PROJECT]", "[LOG]")), }; // Make the request await loggingServiceV2Client.DeleteLogAsync(request); // End snippet }
public async stt::Task DeleteLogAsync() { moq::Mock <LoggingServiceV2.LoggingServiceV2Client> mockGrpcClient = new moq::Mock <LoggingServiceV2.LoggingServiceV2Client>(moq::MockBehavior.Strict); DeleteLogRequest request = new DeleteLogRequest { LogNameAsLogName = LogName.FromProjectLog("[PROJECT]", "[LOG]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteLogAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); LoggingServiceV2Client client = new LoggingServiceV2ClientImpl(mockGrpcClient.Object, null); await client.DeleteLogAsync(request.LogName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteLogAsync(request.LogName, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
private static async Task DeleteLog(LoggingManagementClient client, string logGroupId, string logId) { DeleteLogRequest deleteLogRequest = new DeleteLogRequest { LogGroupId = logGroupId, LogId = logId }; // Pass deleteLogRequest to client to delete the log logger.Info($"Deleting Log {logId}"); logger.Info("============="); DeleteLogResponse response = await client.DeleteLog(deleteLogRequest); string workRequestId = response.OpcWorkRequestId; WaitForWorkRequestFinished(client, workRequestId); logger.Info("Log deleted"); }