Example #1
0
        public async Task <IActionResult> Remove(int InputID)
        {
            LogInput retrieved = await _logContext.LogInputs.FindAsync(InputID);

            if (retrieved == null)
            {
                return(StatusCode(404));
            }
            DeleteDeliveryStreamResponse deleteDeliveryStreamResponse = await _FirehoseClient.DeleteDeliveryStreamAsync(new DeleteDeliveryStreamRequest
            {
                DeliveryStreamName = retrieved.FirehoseStreamName
            });

            await _LambdaClient.RemovePermissionAsync(new RemovePermissionRequest
            {
                FunctionName = Environment.GetEnvironmentVariable("LAMBDA_FUNCTION_NAME"),
                StatementId  = "ID-" + retrieved.LinkedS3Bucket.ID
            });

            DeleteBucketResponse deleteBucketResponse = await _S3Client.DeleteBucketAsync(new DeleteBucketRequest
            {
                BucketName      = retrieved.LinkedS3Bucket.Name,
                UseClientRegion = true,
            });

            _logContext.LogInputs.Remove(retrieved);
            await _logContext.SaveChangesAsync();

            TempData["Alert"]   = "Success";
            TempData["Message"] = "Log Input " + retrieved.Name + " deleted successfully!";
            return(RedirectToAction("Index"));
        }
Example #2
0
 private Amazon.KinesisFirehose.Model.DeleteDeliveryStreamResponse CallAWSServiceOperation(IAmazonKinesisFirehose client, Amazon.KinesisFirehose.Model.DeleteDeliveryStreamRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Kinesis Firehose", "DeleteDeliveryStream");
     try
     {
         #if DESKTOP
         return(client.DeleteDeliveryStream(request));
         #elif CORECLR
         return(client.DeleteDeliveryStreamAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }