github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/obs/model_object.go (about)

     1  // Copyright 2019 Huawei Technologies Co.,Ltd.
     2  // Licensed under the Apache License, Version 2.0 (the "License"); you may not use
     3  // this file except in compliance with the License.  You may obtain a copy of the
     4  // License at
     5  //
     6  // http://www.apache.org/licenses/LICENSE-2.0
     7  //
     8  // Unless required by applicable law or agreed to in writing, software distributed
     9  // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    10  // CONDITIONS OF ANY KIND, either express or implied.  See the License for the
    11  // specific language governing permissions and limitations under the License.
    12  
    13  package obs
    14  
    15  import (
    16  	"encoding/xml"
    17  	"io"
    18  	"time"
    19  )
    20  
    21  // ListObjsInput defines parameters for listing objects
    22  type ListObjsInput struct {
    23  	Prefix        string
    24  	MaxKeys       int
    25  	Delimiter     string
    26  	Origin        string
    27  	RequestHeader string
    28  	EncodingType  string
    29  }
    30  
    31  // ListObjectsInput is the input parameter of ListObjects function
    32  type ListObjectsInput struct {
    33  	ListObjsInput
    34  	Bucket string
    35  	Marker string
    36  }
    37  
    38  // ListObjectsOutput is the result of ListObjects function
    39  type ListObjectsOutput struct {
    40  	BaseModel
    41  	XMLName        xml.Name  `xml:"ListBucketResult"`
    42  	Delimiter      string    `xml:"Delimiter"`
    43  	IsTruncated    bool      `xml:"IsTruncated"`
    44  	Marker         string    `xml:"Marker"`
    45  	NextMarker     string    `xml:"NextMarker"`
    46  	MaxKeys        int       `xml:"MaxKeys"`
    47  	Name           string    `xml:"Name"`
    48  	Prefix         string    `xml:"Prefix"`
    49  	Contents       []Content `xml:"Contents"`
    50  	CommonPrefixes []string  `xml:"CommonPrefixes>Prefix"`
    51  	Location       string    `xml:"-"`
    52  	EncodingType   string    `xml:"EncodingType,omitempty"`
    53  }
    54  
    55  // ListVersionsInput is the input parameter of ListVersions function
    56  type ListVersionsInput struct {
    57  	ListObjsInput
    58  	Bucket          string
    59  	KeyMarker       string
    60  	VersionIdMarker string
    61  }
    62  
    63  // ListVersionsOutput is the result of ListVersions function
    64  type ListVersionsOutput struct {
    65  	BaseModel
    66  	XMLName             xml.Name       `xml:"ListVersionsResult"`
    67  	Delimiter           string         `xml:"Delimiter"`
    68  	IsTruncated         bool           `xml:"IsTruncated"`
    69  	KeyMarker           string         `xml:"KeyMarker"`
    70  	NextKeyMarker       string         `xml:"NextKeyMarker"`
    71  	VersionIdMarker     string         `xml:"VersionIdMarker"`
    72  	NextVersionIdMarker string         `xml:"NextVersionIdMarker"`
    73  	MaxKeys             int            `xml:"MaxKeys"`
    74  	Name                string         `xml:"Name"`
    75  	Prefix              string         `xml:"Prefix"`
    76  	Versions            []Version      `xml:"Version"`
    77  	DeleteMarkers       []DeleteMarker `xml:"DeleteMarker"`
    78  	CommonPrefixes      []string       `xml:"CommonPrefixes>Prefix"`
    79  	Location            string         `xml:"-"`
    80  	EncodingType        string         `xml:"EncodingType,omitempty"`
    81  }
    82  
    83  // DeleteObjectInput is the input parameter of DeleteObject function
    84  type DeleteObjectInput struct {
    85  	Bucket    string
    86  	Key       string
    87  	VersionId string
    88  }
    89  
    90  // DeleteObjectOutput is the result of DeleteObject function
    91  type DeleteObjectOutput struct {
    92  	BaseModel
    93  	VersionId    string
    94  	DeleteMarker bool
    95  }
    96  
    97  // DeleteObjectsInput is the input parameter of DeleteObjects function
    98  type DeleteObjectsInput struct {
    99  	Bucket       string           `xml:"-"`
   100  	XMLName      xml.Name         `xml:"Delete"`
   101  	Quiet        bool             `xml:"Quiet,omitempty"`
   102  	Objects      []ObjectToDelete `xml:"Object"`
   103  	EncodingType string           `xml:"EncodingType"`
   104  }
   105  
   106  // DeleteObjectsOutput is the result of DeleteObjects function
   107  type DeleteObjectsOutput struct {
   108  	BaseModel
   109  	XMLName      xml.Name  `xml:"DeleteResult"`
   110  	Deleteds     []Deleted `xml:"Deleted"`
   111  	Errors       []Error   `xml:"Error"`
   112  	EncodingType string    `xml:"EncodingType,omitempty"`
   113  }
   114  
   115  // SetObjectAclInput is the input parameter of SetObjectAcl function
   116  type SetObjectAclInput struct {
   117  	Bucket    string  `xml:"-"`
   118  	Key       string  `xml:"-"`
   119  	VersionId string  `xml:"-"`
   120  	ACL       AclType `xml:"-"`
   121  	AccessControlPolicy
   122  }
   123  
   124  // GetObjectAclInput is the input parameter of GetObjectAcl function
   125  type GetObjectAclInput struct {
   126  	Bucket    string
   127  	Key       string
   128  	VersionId string
   129  }
   130  
   131  // GetObjectAclOutput is the result of GetObjectAcl function
   132  type GetObjectAclOutput struct {
   133  	BaseModel
   134  	VersionId string
   135  	AccessControlPolicy
   136  }
   137  
   138  // RestoreObjectInput is the input parameter of RestoreObject function
   139  type RestoreObjectInput struct {
   140  	Bucket    string          `xml:"-"`
   141  	Key       string          `xml:"-"`
   142  	VersionId string          `xml:"-"`
   143  	XMLName   xml.Name        `xml:"RestoreRequest"`
   144  	Days      int             `xml:"Days"`
   145  	Tier      RestoreTierType `xml:"GlacierJobParameters>Tier,omitempty"`
   146  }
   147  
   148  // GetObjectMetadataInput is the input parameter of GetObjectMetadata function
   149  type GetObjectMetadataInput struct {
   150  	Bucket        string
   151  	Key           string
   152  	VersionId     string
   153  	Origin        string
   154  	RequestHeader string
   155  	SseHeader     ISseHeader
   156  }
   157  
   158  // GetObjectMetadataOutput is the result of GetObjectMetadata function
   159  type GetObjectMetadataOutput struct {
   160  	BaseModel
   161  	HttpHeader
   162  	VersionId               string
   163  	WebsiteRedirectLocation string
   164  	Expiration              string
   165  	Restore                 string
   166  	ObjectType              string
   167  	NextAppendPosition      string
   168  	StorageClass            StorageClassType
   169  	ContentLength           int64
   170  	ContentType             string
   171  	ETag                    string
   172  	AllowOrigin             string
   173  	AllowHeader             string
   174  	AllowMethod             string
   175  	ExposeHeader            string
   176  	MaxAgeSeconds           int
   177  	LastModified            time.Time
   178  	SseHeader               ISseHeader
   179  	Metadata                map[string]string
   180  }
   181  
   182  type GetAttributeInput struct {
   183  	GetObjectMetadataInput
   184  	RequestPayer string
   185  }
   186  
   187  type GetAttributeOutput struct {
   188  	GetObjectMetadataOutput
   189  	Mode int
   190  }
   191  
   192  // GetObjectInput is the input parameter of GetObject function
   193  type GetObjectInput struct {
   194  	GetObjectMetadataInput
   195  	IfMatch                    string
   196  	IfNoneMatch                string
   197  	AcceptEncoding             string
   198  	IfUnmodifiedSince          time.Time
   199  	IfModifiedSince            time.Time
   200  	RangeStart                 int64
   201  	RangeEnd                   int64
   202  	ImageProcess               string
   203  	ResponseCacheControl       string
   204  	ResponseContentDisposition string
   205  	ResponseContentEncoding    string
   206  	ResponseContentLanguage    string
   207  	ResponseContentType        string
   208  	ResponseExpires            string
   209  }
   210  
   211  // GetObjectOutput is the result of GetObject function
   212  type GetObjectOutput struct {
   213  	GetObjectMetadataOutput
   214  	DeleteMarker       bool
   215  	CacheControl       string
   216  	ContentDisposition string
   217  	ContentEncoding    string
   218  	ContentLanguage    string
   219  	Expires            string
   220  	Body               io.ReadCloser
   221  }
   222  
   223  // ObjectOperationInput defines the object operation properties
   224  type ObjectOperationInput struct {
   225  	Bucket                  string
   226  	Key                     string
   227  	ACL                     AclType
   228  	GrantReadId             string
   229  	GrantReadAcpId          string
   230  	GrantWriteAcpId         string
   231  	GrantFullControlId      string
   232  	StorageClass            StorageClassType
   233  	WebsiteRedirectLocation string
   234  	Expires                 int64
   235  	SseHeader               ISseHeader
   236  	Metadata                map[string]string
   237  	HttpHeader
   238  }
   239  
   240  // PutObjectBasicInput defines the basic object operation properties
   241  type PutObjectBasicInput struct {
   242  	ObjectOperationInput
   243  	ContentMD5    string
   244  	ContentLength int64
   245  }
   246  
   247  // PutObjectInput is the input parameter of PutObject function
   248  type PutObjectInput struct {
   249  	PutObjectBasicInput
   250  	Body io.Reader
   251  }
   252  
   253  type NewFolderInput struct {
   254  	ObjectOperationInput
   255  	RequestPayer string
   256  }
   257  
   258  type NewFolderOutput struct {
   259  	PutObjectOutput
   260  }
   261  
   262  // PutFileInput is the input parameter of PutFile function
   263  type PutFileInput struct {
   264  	PutObjectBasicInput
   265  	SourceFile string
   266  }
   267  
   268  // PutObjectOutput is the result of PutObject function
   269  type PutObjectOutput struct {
   270  	BaseModel
   271  	VersionId    string
   272  	SseHeader    ISseHeader
   273  	StorageClass StorageClassType
   274  	ETag         string
   275  	ObjectUrl    string
   276  	CallbackBody
   277  }
   278  
   279  // CopyObjectInput is the input parameter of CopyObject function
   280  type CopyObjectInput struct {
   281  	ObjectOperationInput
   282  	CopySourceBucket            string
   283  	CopySourceKey               string
   284  	CopySourceVersionId         string
   285  	CopySourceIfMatch           string
   286  	CopySourceIfNoneMatch       string
   287  	CopySourceIfUnmodifiedSince time.Time
   288  	CopySourceIfModifiedSince   time.Time
   289  	SourceSseHeader             ISseHeader
   290  	CacheControl                string
   291  	ContentDisposition          string
   292  	ContentEncoding             string
   293  	ContentLanguage             string
   294  	ContentType                 string
   295  	Expires                     string
   296  	MetadataDirective           MetadataDirectiveType
   297  	SuccessActionRedirect       string
   298  }
   299  
   300  // CopyObjectOutput is the result of CopyObject function
   301  type CopyObjectOutput struct {
   302  	BaseModel
   303  	CopySourceVersionId string     `xml:"-"`
   304  	VersionId           string     `xml:"-"`
   305  	SseHeader           ISseHeader `xml:"-"`
   306  	XMLName             xml.Name   `xml:"CopyObjectResult"`
   307  	LastModified        time.Time  `xml:"LastModified"`
   308  	ETag                string     `xml:"ETag"`
   309  }
   310  
   311  // UploadFileInput is the input parameter of UploadFile function
   312  type UploadFileInput struct {
   313  	ObjectOperationInput
   314  	ContentType      string
   315  	UploadFile       string
   316  	PartSize         int64
   317  	TaskNum          int
   318  	EnableCheckpoint bool
   319  	CheckpointFile   string
   320  	EncodingType     string
   321  }
   322  
   323  // DownloadFileInput is the input parameter of DownloadFile function
   324  type DownloadFileInput struct {
   325  	GetObjectMetadataInput
   326  	IfMatch           string
   327  	IfNoneMatch       string
   328  	IfModifiedSince   time.Time
   329  	IfUnmodifiedSince time.Time
   330  	DownloadFile      string
   331  	PartSize          int64
   332  	TaskNum           int
   333  	EnableCheckpoint  bool
   334  	CheckpointFile    string
   335  }
   336  
   337  type AppendObjectInput struct {
   338  	PutObjectBasicInput
   339  	Body     io.Reader
   340  	Position int64
   341  }
   342  
   343  type AppendObjectOutput struct {
   344  	BaseModel
   345  	VersionId          string
   346  	SseHeader          ISseHeader
   347  	NextAppendPosition int64
   348  	ETag               string
   349  }
   350  
   351  type ModifyObjectInput struct {
   352  	Bucket        string
   353  	Key           string
   354  	Position      int64
   355  	Body          io.Reader
   356  	ContentLength int64
   357  }
   358  
   359  type ModifyObjectOutput struct {
   360  	BaseModel
   361  	ETag string
   362  }
   363  
   364  // HeadObjectInput is the input parameter of HeadObject function
   365  type HeadObjectInput struct {
   366  	Bucket    string
   367  	Key       string
   368  	VersionId string
   369  }
   370  
   371  type RenameFileInput struct {
   372  	Bucket       string
   373  	Key          string
   374  	NewObjectKey string
   375  	RequestPayer string
   376  }
   377  
   378  type RenameFileOutput struct {
   379  	BaseModel
   380  }
   381  
   382  type RenameFolderInput struct {
   383  	Bucket       string
   384  	Key          string
   385  	NewObjectKey string
   386  	RequestPayer string
   387  }
   388  
   389  type RenameFolderOutput struct {
   390  	BaseModel
   391  }
   392  
   393  // SetObjectMetadataInput is the input parameter of SetObjectMetadata function
   394  type SetObjectMetadataInput struct {
   395  	Bucket                  string
   396  	Key                     string
   397  	VersionId               string
   398  	MetadataDirective       MetadataDirectiveType
   399  	Expires                 string
   400  	WebsiteRedirectLocation string
   401  	StorageClass            StorageClassType
   402  	Metadata                map[string]string
   403  	HttpHeader
   404  }
   405  
   406  // SetObjectMetadataOutput is the result of SetObjectMetadata function
   407  type SetObjectMetadataOutput struct {
   408  	BaseModel
   409  	MetadataDirective       MetadataDirectiveType
   410  	CacheControl            string
   411  	ContentDisposition      string
   412  	ContentEncoding         string
   413  	ContentLanguage         string
   414  	ContentType             string
   415  	Expires                 string
   416  	WebsiteRedirectLocation string
   417  	StorageClass            StorageClassType
   418  	Metadata                map[string]string
   419  }