public static void WebsiteSerial() { System.Console.WriteLine("\nhello,Website!!"); NameValueCollection appConfig = ConfigurationManager.AppSettings; AmazonS3 s3Client = AWSClientFactory.CreateAmazonS3Client(appConfig["AWSAccessKey"], appConfig["AWSSecretKey"]); String bucketName = "chttest2"; //PutBucket //PutBucketResponse response = s3Client.PutBucket(new PutBucketRequest().WithBucketName(bucketName)); //PutBucketWebsite,已修正此問題,待新版code release即可正常使用 WebsiteConfiguration config = new WebsiteConfiguration(); config.WithErrorDocument("404Test.html"); config.WithIndexDocumentSuffix("indexTest.html"); PutBucketWebsiteResponse putBucketWebsiteResult = s3Client.PutBucketWebsite(new PutBucketWebsiteRequest().WithBucketName(bucketName).WithWebsiteConfiguration(config)); System.Console.WriteLine("\nPutBucketWebsite, requestID:{0}",putBucketWebsiteResult.RequestId); //GetBucketWebsite GetBucketWebsiteResponse getBucketWebsiteResult = s3Client.GetBucketWebsite(new GetBucketWebsiteRequest().WithBucketName(bucketName)); System.Console.WriteLine("\nGetBucketWebsite Result:\n{0}",getBucketWebsiteResult.ResponseXml); //DeleteBucketWebsite DeleteBucketWebsiteResponse deleteBucketWebsiteResult = s3Client.DeleteBucketWebsite(new DeleteBucketWebsiteRequest().WithBucketName(bucketName)); System.Console.WriteLine("\nDeleteBucketWebsite, requestID:{0}",deleteBucketWebsiteResult.RequestId); //DeleteBucket System.Console.WriteLine("Delete Bucket!"); s3Client.DeleteBucket(new DeleteBucketRequest().WithBucketName(bucketName)); System.Console.WriteLine("END!"); }
/// <summary> /// Sets the WithWebsiteConfiguration property for this request. /// </summary> /// <param name="config">The value that WithWebsiteConfiguration is set to</param> /// <returns>the request with the WebsiteConfiguration set</returns> public GetBucketWebsiteResponse WithWebsiteConfiguration(WebsiteConfiguration config) { this.WebsiteConfiguration = config; return this; }
public PutBucketWebsiteRequest WithWebsiteConfiguration(WebsiteConfiguration config) { this.WebsiteConfiguration = config; return this; }
/// <summary> /// Sets the WithWebsiteConfiguration property for this request. /// </summary> /// <param name="config">The value that WithWebsiteConfiguration is set to</param> /// <returns>the request with the WebsiteConfiguration set</returns> public GetBucketWebsiteResponse WithWebsiteConfiguration(WebsiteConfiguration config) { this.WebsiteConfiguration = config; return(this); }
/// <summary> /// Set the website configuration for a bucket. /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value of this configuration option is AWSConfigs.HttpClientOption.UnityWWW /// </summary> /// <param name="bucketName">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite service method.</param> /// <param name="websiteConfiguration">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite service method.</param> /// <param name="callback">An Action delegate that is invoked when the operation completes.</param> /// <param name="options"> /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// </param> /// /// <returns>The response from the PutBucketWebsite service method, as returned by S3.</returns> public void PutBucketWebsiteAsync(string bucketName, WebsiteConfiguration websiteConfiguration, AmazonServiceCallback<PutBucketWebsiteRequest, PutBucketWebsiteResponse> callback, AsyncOptions options = null) { var request = new PutBucketWebsiteRequest(); request.BucketName = bucketName; request.WebsiteConfiguration = websiteConfiguration; PutBucketWebsiteAsync(request, callback, options); }
/// <summary> /// Set the website configuration for a bucket. /// </summary> /// <param name="bucketName">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite service method.</param> /// <param name="websiteConfiguration">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the PutBucketWebsite service method, as returned by S3.</returns> public Task<PutBucketWebsiteResponse> PutBucketWebsiteAsync(string bucketName, WebsiteConfiguration websiteConfiguration, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new PutBucketWebsiteRequest(); request.BucketName = bucketName; request.WebsiteConfiguration = websiteConfiguration; return PutBucketWebsiteAsync(request, cancellationToken); }
/// <summary> /// Set the website configuration for a bucket. /// </summary> /// <param name="bucketName">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite service method.</param> /// <param name="websiteConfiguration">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite service method.</param> /// /// <returns>The response from the PutBucketWebsite service method, as returned by S3.</returns> public PutBucketWebsiteResponse PutBucketWebsite(string bucketName, WebsiteConfiguration websiteConfiguration) { var request = new PutBucketWebsiteRequest(); request.BucketName = bucketName; request.WebsiteConfiguration = websiteConfiguration; return PutBucketWebsite(request); }
/// <summary> /// The website configuration to apply. The configuration defines the index /// document suffix and custom error page. /// </summary> /// <param name="config">The configuration details</param> /// <returns>the request with the WebsiteConfiguration set</returns> public PutBucketWebsiteRequest WithWebsiteConfiguration(WebsiteConfiguration config) { this.WebsiteConfiguration = config; return(this); }