2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/ *  
						 
					
						
							
								
									
										
										
										
											2015-07-25 08:51:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 *  Minio  Cloud  Storage ,  ( C )  2015  Minio ,  Inc . 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Licensed  under  the  Apache  License ,  Version  2.0  ( the  "License" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  you  may  not  use  this  file  except  in  compliance  with  the  License . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  You  may  obtain  a  copy  of  the  License  at 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *      http : //www.apache.org/licenses/LICENSE-2.0
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Unless  required  by  applicable  law  or  agreed  to  in  writing ,  software 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  distributed  under  the  License  is  distributed  on  an  "AS IS"  BASIS , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  WITHOUT  WARRANTIES  OR  CONDITIONS  OF  ANY  KIND ,  either  express  or  implied . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  See  the  License  for  the  specific  language  governing  permissions  and 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  limitations  under  the  License . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * / 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-19 07:23:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								package  cmd  
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								import  (  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									"fmt" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									"io" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								)  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Converts underlying storage error. Convenience function written to
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// handle all cases where we have known types of errors returned by
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// underlying storage layer.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  toObjectErr ( err  error ,  params  ... string )  error  {  
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									e ,  ok  :=  err . ( * Error ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ok  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										err  =  e . e 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									switch  err  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  errVolumeNotFound : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  len ( params )  >=  1  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											err  =  BucketNotFound { Bucket :  params [ 0 ] } 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-05 16:35:21 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  errVolumeNotEmpty : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  len ( params )  >=  1  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											err  =  BucketNotEmpty { Bucket :  params [ 0 ] } 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-05 16:35:21 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  errVolumeExists : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  len ( params )  >=  1  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											err  =  BucketExists { Bucket :  params [ 0 ] } 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  errDiskFull : 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										err  =  StorageFull { } 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 07:09:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  errFileAccessDenied : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  len ( params )  >=  2  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											err  =  PrefixAccessDenied { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Bucket :  params [ 0 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Object :  params [ 1 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-05 03:18:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  errIsNotRegular ,  errFileAccessDenied : 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  len ( params )  >=  2  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											err  =  ObjectExistsAsDirectory { 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												Bucket :  params [ 0 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Object :  params [ 1 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-23 07:19:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  errFileNotFound : 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  len ( params )  >=  2  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											err  =  ObjectNotFound { 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												Bucket :  params [ 0 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Object :  params [ 1 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 03:55:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  errFileNameTooLong : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  len ( params )  >=  2  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											err  =  ObjectNameInvalid { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 03:55:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												Bucket :  params [ 0 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Object :  params [ 1 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-23 00:05:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  errDataTooLarge : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  len ( params )  >=  2  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											err  =  ObjectTooLarge { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Bucket :  params [ 0 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Object :  params [ 1 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-25 14:47:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  errDataTooSmall : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  len ( params )  >=  2  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											err  =  ObjectTooSmall { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Bucket :  params [ 0 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Object :  params [ 1 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-03 07:34:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  errXLReadQuorum : 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										err  =  InsufficientReadQuorum { } 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-03 07:34:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  errXLWriteQuorum : 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										err  =  InsufficientWriteQuorum { } 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									case  io . ErrUnexpectedEOF ,  io . ErrShortWrite : 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 00:39:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										err  =  IncompleteBody { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ok  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										e . e  =  err 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  e 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  err 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2015-07-01 07:30:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-11 07:52:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// SignatureDoesNotMatch - when content md5 does not match with what was sent from client.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  SignatureDoesNotMatch  struct { }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  SignatureDoesNotMatch )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "The request signature we calculated does not match the signature you provided. Check your key and signing method." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// StorageFull storage ran out of space.
  
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  StorageFull  struct { }  
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								func  ( e  StorageFull )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Storage reached its minimum free disk threshold." 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-06 11:24:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// InsufficientReadQuorum storage cannot satisfy quorum for read operation.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  InsufficientReadQuorum  struct { }  
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-06 11:24:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								func  ( e  InsufficientReadQuorum )  Error ( )  string  {  
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									return  "Storage resources are insufficient for the read operation." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-06 11:24:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// InsufficientWriteQuorum storage cannot satisfy quorum for write operation.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  InsufficientWriteQuorum  struct { }  
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-06 11:24:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								func  ( e  InsufficientWriteQuorum )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Storage resources are insufficient for the write operation." 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-21 08:23:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// GenericError - generic object layer error.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  GenericError  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Bucket  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  string 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-18 10:17:33 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// BucketNotFound bucket does not exist.
  
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  BucketNotFound  GenericError  
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  BucketNotFound )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Bucket not found: "  +  e . Bucket 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-09 05:53:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// BucketAlreadyExists the requested bucket name is not available.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  BucketAlreadyExists  GenericError  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  BucketAlreadyExists )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-28 02:26:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// BucketAlreadyOwnedByYou already owned by you.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  BucketAlreadyOwnedByYou  GenericError  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  BucketAlreadyOwnedByYou )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Bucket already owned by you: "  +  e . Bucket 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// BucketNotEmpty bucket is not empty.
  
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  BucketNotEmpty  GenericError  
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-17 02:26:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								func  ( e  BucketNotEmpty )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Bucket not empty: "  +  e . Bucket 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// ObjectNotFound object does not exist.
  
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  ObjectNotFound  GenericError  
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  ObjectNotFound )  Error ( )  string  {  
						 
					
						
							
								
									
										
										
										
											2015-10-17 02:26:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									return  "Object not found: "  +  e . Bucket  +  "#"  +  e . Object 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-09 03:36:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// ObjectExistsAsDirectory object already exists as a directory.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  ObjectExistsAsDirectory  GenericError  
						 
					
						
							
								
									
										
										
										
											2016-02-03 07:23:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-09 03:36:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								func  ( e  ObjectExistsAsDirectory )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Object exists on : "  +  e . Bucket  +  " as directory "  +  e . Object 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-21 07:09:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								//PrefixAccessDenied object access is denied.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  PrefixAccessDenied  GenericError  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  PrefixAccessDenied )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Prefix access is denied: "  +  e . Bucket  +  "/"  +  e . Object 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// BucketExists bucket exists.
  
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  BucketExists  GenericError  
						 
					
						
							
								
									
										
										
										
											2015-06-24 02:44:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  BucketExists )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Bucket exists: "  +  e . Bucket 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-11 16:29:18 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// UnsupportedDelimiter - unsupported delimiter.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  UnsupportedDelimiter  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Delimiter  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  UnsupportedDelimiter )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  fmt . Sprintf ( "delimiter '%s' is not supported. Only '/' is supported" ,  e . Delimiter ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// InvalidUploadIDKeyCombination - invalid upload id and key marker combination.
  
						 
					
						
							
								
									
										
										
										
											2016-04-11 16:29:18 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  InvalidUploadIDKeyCombination  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UploadIDMarker ,  KeyMarker  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  InvalidUploadIDKeyCombination )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  fmt . Sprintf ( "Invalid combination of uploadID marker '%s' and marker '%s'" ,  e . UploadIDMarker ,  e . KeyMarker ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// InvalidMarkerPrefixCombination - invalid marker and prefix combination.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  InvalidMarkerPrefixCombination  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Marker ,  Prefix  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  InvalidMarkerPrefixCombination )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  fmt . Sprintf ( "Invalid combination of marker '%s' and prefix '%s'" ,  e . Marker ,  e . Prefix ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
   "*":                             true,
   "s3:*":                          true,
   "s3:GetObject":                  true,
   "s3:ListBucket":                 true,
   "s3:PutObject":                  true,
   "s3:CreateBucket":               true,
   "s3:GetBucketLocation":          true,
   "s3:DeleteBucket":               true,
   "s3:DeleteObject":               true,
   "s3:AbortMultipartUpload":       true,
   "s3:ListBucketMultipartUploads": true,
   "s3:ListMultipartUploadParts":   true,
following conditions for "StringEquals" and "StringNotEquals"
   "s3:prefix", "s3:max-keys"
											 
										 
										
											2016-02-04 08:46:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// BucketPolicyNotFound - no bucket policy found.
  
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  BucketPolicyNotFound  GenericError  
						 
					
						
							
								
									
										
										
											
												accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
   "*":                             true,
   "s3:*":                          true,
   "s3:GetObject":                  true,
   "s3:ListBucket":                 true,
   "s3:PutObject":                  true,
   "s3:CreateBucket":               true,
   "s3:GetBucketLocation":          true,
   "s3:DeleteBucket":               true,
   "s3:DeleteObject":               true,
   "s3:AbortMultipartUpload":       true,
   "s3:ListBucketMultipartUploads": true,
   "s3:ListMultipartUploadParts":   true,
following conditions for "StringEquals" and "StringNotEquals"
   "s3:prefix", "s3:max-keys"
											 
										 
										
											2016-02-04 08:46:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  BucketPolicyNotFound )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "No bucket policy found for bucket: "  +  e . Bucket 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/// Bucket related errors.
  
						 
					
						
							
								
									
										
										
										
											2015-07-01 07:30:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// BucketNameInvalid - bucketname provided is invalid.
  
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  BucketNameInvalid  GenericError  
						 
					
						
							
								
									
										
										
										
											2015-07-01 07:30:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// Return string an error formatted as the given text.
  
						 
					
						
							
								
									
										
										
										
											2015-07-01 07:30:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								func  ( e  BucketNameInvalid )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Bucket name invalid: "  +  e . Bucket 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/// Object related errors.
  
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// ObjectNameInvalid - object name provided is invalid.
  
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  ObjectNameInvalid  GenericError  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// Return string an error formatted as the given text.
  
						 
					
						
							
								
									
										
										
										
											2015-07-01 07:30:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								func  ( e  ObjectNameInvalid )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Object name invalid: "  +  e . Bucket  +  "#"  +  e . Object 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-06 09:49:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// AllAccessDisabled All access to this object has been disabled
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  AllAccessDisabled  GenericError  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Return string an error formatted as the given text.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  AllAccessDisabled )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "All access to this object has been disabled" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// IncompleteBody You did not provide the number of bytes specified by the Content-Length HTTP header.
  
						 
					
						
							
								
									
										
										
										
											2016-04-19 17:42:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  IncompleteBody  GenericError  
						 
					
						
							
								
									
										
										
										
											2015-07-09 11:18:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// Return string an error formatted as the given text.
  
						 
					
						
							
								
									
										
										
										
											2015-07-09 11:18:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								func  ( e  IncompleteBody )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  e . Bucket  +  "#"  +  e . Object  +  "has incomplete body" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-09 08:22:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// InvalidRange - invalid range typed error.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  InvalidRange  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									offsetBegin   int64 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									offsetEnd     int64 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									resourceSize  int64 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  InvalidRange )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  fmt . Sprintf ( "The requested range \"bytes %d-%d/%d\" is not satisfiable." ,  e . offsetBegin ,  e . offsetEnd ,  e . resourceSize ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-23 00:05:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// ObjectTooLarge error returned when the size of the object > max object size allowed (5G) per request.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  ObjectTooLarge  GenericError  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  ObjectTooLarge )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "size of the object greater than what is allowed(5G)" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-25 14:47:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// ObjectTooSmall error returned when the size of the object < what is expected.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  ObjectTooSmall  GenericError  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  ObjectTooSmall )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "size of the object less than what is expected" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-01 02:29:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// OperationTimedOut - a timeout occurred.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  OperationTimedOut  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Path  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  OperationTimedOut )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Operation timed out: "  +  e . Path 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 10:28:13 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/// Multipart related errors.
  
						 
					
						
							
								
									
										
										
										
											2015-07-01 07:30:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-11 16:29:18 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// MalformedUploadID malformed upload id.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  MalformedUploadID  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UploadID  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  MalformedUploadID )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Malformed upload id "  +  e . UploadID 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// InvalidUploadID invalid upload id.
  
						 
					
						
							
								
									
										
										
										
											2015-07-01 07:30:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  InvalidUploadID  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									UploadID  string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  InvalidUploadID )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Invalid upload id "  +  e . UploadID 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2015-07-09 07:54:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-14 10:29:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// InvalidPart One or more of the specified parts could not be found
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  InvalidPart  struct { }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  InvalidPart )  Error ( )  string  {  
						 
					
						
							
								
									
										
										
										
											2017-06-18 02:20:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  "One or more of the specified parts could not be found. The part may not have been uploaded, or the specified entity tag may not match the part's entity tag." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-14 10:29:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-05-09 03:06:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-18 03:01:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// PartsSizeUnequal - All parts except the last part should be of the same size
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  PartsSizeUnequal  struct { }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  PartsSizeUnequal )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "All parts except the last part should be of the same size" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-09 03:06:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// PartTooSmall - error if part size is less than 5MB.
  
						 
					
						
							
								
									
										
										
										
											2016-06-29 05:51:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  PartTooSmall  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PartSize    int64 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PartNumber  int 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PartETag    string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-05-09 03:06:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  PartTooSmall )  Error ( )  string  {  
						 
					
						
							
								
									
										
										
										
											2017-10-28 06:07:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  fmt . Sprintf ( "Part size for %d should be at least 5MB" ,  e . PartNumber ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-09 03:06:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-08-18 02:36:33 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-13 07:42:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// PartTooBig returned if size of part is bigger than the allowed limit.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  PartTooBig  struct { }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  PartTooBig )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Part size bigger than the allowed limit" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-18 02:36:33 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// NotImplemented If a feature is not implemented
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  NotImplemented  struct { }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  NotImplemented )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Not Implemented" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-11-17 08:42:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-24 09:31:11 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// PolicyNesting - policy nesting conflict.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  PolicyNesting  struct { }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  PolicyNesting )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "New bucket policy conflicts with an existing policy. Please try again with new prefix." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-28 02:26:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// PolicyNotFound - policy not found
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  PolicyNotFound  GenericError  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  PolicyNotFound )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Policy not found" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-13 07:14:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// UnsupportedMetadata - unsupported metadata
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								type  UnsupportedMetadata  struct { }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( e  UnsupportedMetadata )  Error ( )  string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  "Unsupported headers in Metadata" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 09:37:57 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// Check if error type is IncompleteBody.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  isErrIncompleteBody ( err  error )  bool  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									err  =  errorCause ( err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  err . ( type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  IncompleteBody : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Check if error type is BucketPolicyNotFound.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  isErrBucketPolicyNotFound ( err  error )  bool  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									err  =  errorCause ( err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  err . ( type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  BucketPolicyNotFound : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-17 08:42:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// Check if error type is ObjectNotFound.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  isErrObjectNotFound ( err  error )  bool  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									err  =  errorCause ( err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  err . ( type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  ObjectNotFound : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}