本文整理汇总了C#中Amazon.S3.AmazonS3Client.GetBucketWebsite方法的典型用法代码示例。如果您正苦于以下问题:C# AmazonS3Client.GetBucketWebsite方法的具体用法?C# AmazonS3Client.GetBucketWebsite怎么用?C# AmazonS3Client.GetBucketWebsite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Amazon.S3.AmazonS3Client
的用法示例。
在下文中一共展示了AmazonS3Client.GetBucketWebsite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetS3Buckets
//.........这里部分代码省略.........
}
var createddate = abucket.CreationDate;
string owner = "";
string grants = "";
string tags = "";
string lastaccess = "";
string defaultpage = "";
string website = "";
//Now start pulling der einen data.
GetACLRequest GACR = new GetACLRequest();
GACR.BucketName = name;
var ACL = BS3Client.GetACL(GACR);
var grantlist = ACL.AccessControlList;
owner = grantlist.Owner.DisplayName;
foreach (var agrant in grantlist.Grants)
{
if (grants.Length > 1) grants += "\n";
var gName = agrant.Grantee.DisplayName;
var gType = agrant.Grantee.Type.Value;
var aMail = agrant.Grantee.EmailAddress;
if (gType.Equals("Group"))
{
grants += gType + " - " + agrant.Grantee.URI + " - " + agrant.Permission + " - " + aMail;
}
else
{
grants += gName + " - " + agrant.Permission + " - " + aMail;
}
}
GetBucketWebsiteRequest GBWReq = new GetBucketWebsiteRequest();
GBWReq.BucketName = name;
GetBucketWebsiteResponse GBWRes = BS3Client.GetBucketWebsite(GBWReq);
defaultpage = GBWRes.WebsiteConfiguration.IndexDocumentSuffix;
if (defaultpage != null)
{
website = @"http://" + name + @".s3-website-" + region + @".amazonaws.com/" + defaultpage;
}
abucketrow["AccountID"] = accountid;
abucketrow["Profile"] = aprofile;
abucketrow["Bucket"] = name;
abucketrow["Region"] = region;
abucketrow["RegionEndpoint"] = EP;
abucketrow["AuthRegion"] = authregion;
abucketrow["AuthService"] = authservice;
abucketrow["CreationDate"] = createddate.ToString();
abucketrow["LastAccess"] = lastaccess;
abucketrow["Owner"] = owner;
abucketrow["Grants"] = grants;
abucketrow["StartDate"] = "NA";
abucketrow["StartSizeMin"] = "NA";
abucketrow["StartSizeAVG"] = "NA";
abucketrow["StartSizeMax"] = "NA";
abucketrow["EndDate"] = "NA";
abucketrow["EndSizeMin"] = "NA";
abucketrow["EndSizeAVG"] = "NA";
abucketrow["EndSizeMax"] = "NA";
abucketrow["EndSizeMaxBytes"] = 0;
示例2: ScanProfile
//.........这里部分代码省略.........
string lastaccess = "";
string defaultpage = "";
string website = "";
//Now start pulling der einen data.
GetACLRequest GACR = new GetACLRequest();
GACR.BucketName = name;
var ACL = BS3Client.GetACL(GACR);
var grantlist = ACL.AccessControlList;
owner = grantlist.Owner.DisplayName;
foreach (var agrant in grantlist.Grants)
{
if (grants.Length > 1) grants += "\n";
var gName = agrant.Grantee.DisplayName;
var gType = agrant.Grantee.Type.Value;
var aMail = agrant.Grantee.EmailAddress;
if (gType.Equals("Group"))
{
grants += gType + " - " + agrant.Grantee.URI + " - " + agrant.Permission + " - " + aMail ;
}
else
{
grants += gName + " - "+ agrant.Permission + " - " + aMail;
}
}
GetObjectMetadataRequest request = new GetObjectMetadataRequest();
request.BucketName = name;
GetObjectMetadataResponse MDresponse = BS3Client.GetObjectMetadata(request);
lastaccess = MDresponse.LastModified.ToString();
//defaultpage = MDresponse.WebsiteRedirectLocation;
GetBucketWebsiteRequest GBWReq = new GetBucketWebsiteRequest();
GBWReq.BucketName = name;
GetBucketWebsiteResponse GBWRes = BS3Client.GetBucketWebsite(GBWReq);
defaultpage = GBWRes.WebsiteConfiguration.IndexDocumentSuffix;
if (defaultpage != null)
{
website = @"http://" + name + @".s3-website-" + region + @".amazonaws.com/" + defaultpage;
}
//Amazon.S3.Model.req
abucketrow["AccountID"] = accountid;
abucketrow["Profile"] = aprofile;
abucketrow["Bucket"] = name;
abucketrow["Region"] = region;
abucketrow["CreationDate"] = createddate.ToString();
abucketrow["LastAccess"] = lastaccess;
abucketrow["Owner"] = owner;
abucketrow["Grants"] = grants;
abucketrow["WebsiteHosting"] = website;
abucketrow["Logging"] = "X";
abucketrow["Events"] = "X";
abucketrow["Versioning"] = "X";
abucketrow["LifeCycle"] = "X";
abucketrow["Replication"] = "X";
abucketrow["Tags"] = "X";
abucketrow["RequesterPays"] = "X";
S3DetailsTable.Rows.Add(abucketrow.ItemArray);
}