using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.IO; using System.Net.Http; using System.Net.Http.Headers; using Amazon.S3; using Amazon.S3.Transfer; namespace rockfishCore.Util { public static class OpsDiagnostics { private static HttpClient Client = new HttpClient(); public static bool CheckWebsite(string url, string mustContain) { bool Result = false; var Response = Client.GetAsync(url).Result; if (Response.IsSuccessStatusCode) { var PageText = Response.Content.ReadAsStringAsync().Result; if (PageText.Contains(mustContain)) { Result = true; } } return Result; } public static bool CheckSpacesBackupStorage() { var SECRET_KEY = "iNwbHr+sK+9is2wmRjIax+rdyEjLNvWKJBYr7w4txkY"; var ACCESS_KEY = "CMPAFDNX53OWPC55HBJ4"; var HOST_ENDPOINT = "https://nyc3.digitaloceanspaces.com"; var BUCKET = "%(bucket)s.nyc3.digitaloceanspaces.com"; AmazonS3Config clientConfig=new AmazonS3Config(); clientConfig.ServiceURL=HOST_ENDPOINT; IAmazonS3 s3Client = new AmazonS3Client(ACCESS_KEY, SECRET_KEY, clientConfig); var bucketlist=s3Client.ListBucketsAsync().Result; // IAmazonS3 amazonS3Client = new // AWSClientFactory.CreateAmazonS3Client("your-spaces-key", "your-spaces-key-secrete", // new AmazonS3Config // { // ServiceURL = "https://nyc3.digitaloceanspaces.com" // } // ); // var myBuckets = amazonS3Client.ListBuckets(); return false; } }//eoc }//eons