コード例 #1
0
        static void DeleteObjectTags()
        {
            string id  = Common.InputString("Key:", null, false);
            int    ver = Common.InputInteger("Version:", 1, true, false);

            try
            {
                DeleteObjectTaggingRequest request = new DeleteObjectTaggingRequest();
                request.BucketName = _Bucket;
                request.Key        = id;
                request.VersionId  = ver.ToString();

                DeleteObjectTaggingResponse response = _S3Client.DeleteObjectTaggingAsync(request).Result;
                int statusCode = (int)response.HttpStatusCode;

                if (response != null)
                {
                    Console.WriteLine("Success");
                    return;
                }
                else
                {
                    Console.WriteLine("Failed");
                    return;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(Common.SerializeJson(e, true));
            }
        }
 private Amazon.S3.Model.DeleteObjectTaggingResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.DeleteObjectTaggingRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "DeleteObjectTagging");
     try
     {
         #if DESKTOP
         return(client.DeleteObjectTagging(request));
         #elif CORECLR
         return(client.DeleteObjectTaggingAsync(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;
     }
 }