This commit is contained in:
2018-07-26 21:50:44 +00:00
parent 18e851c9c2
commit 9ff40447a0
4 changed files with 42 additions and 3 deletions

View File

@@ -129,6 +129,16 @@ namespace rockfishCore.Controllers
//devops: https://test.helloayanova.com/api/v8/ //devops: https://test.helloayanova.com/api/v8/
//Spaces and backup: https://gztw1.nyc3.digitaloceanspaces.com/ //Spaces and backup: https://gztw1.nyc3.digitaloceanspaces.com/
//Need S3 library for c# //Need S3 library for c#
/*
IAmazonS3 amazonS3Client =
AWSClientFactory.CreateAmazonS3Client("your-spaces-key", "your-spaces-key-secrete",
new AmazonS3Config
{
ServiceURL = "https://nyc3.digitaloceanspaces.com"
}
);
var myBuckets = amazonS3Client.ListBuckets();
*/
return Ret; return Ret;

View File

@@ -110,7 +110,7 @@ namespace rockfishCore
//bool bMM=RfMail.MailIsMirroringProperly(); //bool bMM=RfMail.MailIsMirroringProperly();
try try
{ {
var test = OpsDiagnostics.CheckWebsite("https://test.helloayanova.com/api/v8/", "AyaNova server"); var test = OpsDiagnostics.CheckSpacesBackupStorage();
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -8,6 +8,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AWSSDK.Core" Version="3.3.24.4" />
<PackageReference Include="AWSSDK.S3" Version="3.3.20" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" /> <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />

View File

@@ -5,6 +5,8 @@ using System.Linq;
using System.IO; using System.IO;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using Amazon.S3;
using Amazon.S3.Transfer;
namespace rockfishCore.Util namespace rockfishCore.Util
{ {
@@ -20,15 +22,40 @@ namespace rockfishCore.Util
if (Response.IsSuccessStatusCode) if (Response.IsSuccessStatusCode)
{ {
var PageText = Response.Content.ReadAsStringAsync().Result; var PageText = Response.Content.ReadAsStringAsync().Result;
if(PageText.Contains(mustContain)) if (PageText.Contains(mustContain))
{ {
Result=true; Result = true;
} }
} }
return Result; 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;
}