github.com/TrueCloudLab/frostfs-api-go/v2@v2.0.0-20230228134343-196241c4e79a/container/types.go (about)

     1  package container
     2  
     3  import (
     4  	"github.com/TrueCloudLab/frostfs-api-go/v2/acl"
     5  	"github.com/TrueCloudLab/frostfs-api-go/v2/netmap"
     6  	"github.com/TrueCloudLab/frostfs-api-go/v2/refs"
     7  	"github.com/TrueCloudLab/frostfs-api-go/v2/session"
     8  )
     9  
    10  type Attribute struct {
    11  	key, val string
    12  }
    13  
    14  type Container struct {
    15  	version *refs.Version
    16  
    17  	ownerID *refs.OwnerID
    18  
    19  	nonce []byte
    20  
    21  	basicACL uint32
    22  
    23  	attr []Attribute
    24  
    25  	policy *netmap.PlacementPolicy
    26  }
    27  
    28  type PutRequestBody struct {
    29  	cnr *Container
    30  
    31  	sig *refs.Signature
    32  }
    33  type PutRequest struct {
    34  	body *PutRequestBody
    35  
    36  	session.RequestHeaders
    37  }
    38  
    39  type PutResponseBody struct {
    40  	cid *refs.ContainerID
    41  }
    42  
    43  type PutResponse struct {
    44  	body *PutResponseBody
    45  
    46  	session.ResponseHeaders
    47  }
    48  
    49  type GetRequestBody struct {
    50  	cid *refs.ContainerID
    51  }
    52  
    53  type GetRequest struct {
    54  	body *GetRequestBody
    55  
    56  	session.RequestHeaders
    57  }
    58  
    59  type GetResponseBody struct {
    60  	cnr *Container
    61  
    62  	token *session.Token
    63  
    64  	sig *refs.Signature
    65  }
    66  
    67  type GetResponse struct {
    68  	body *GetResponseBody
    69  
    70  	session.ResponseHeaders
    71  }
    72  
    73  type DeleteRequestBody struct {
    74  	cid *refs.ContainerID
    75  
    76  	sig *refs.Signature
    77  }
    78  
    79  type DeleteRequest struct {
    80  	body *DeleteRequestBody
    81  
    82  	session.RequestHeaders
    83  }
    84  
    85  type DeleteResponseBody struct{}
    86  
    87  type DeleteResponse struct {
    88  	body *DeleteResponseBody
    89  
    90  	session.ResponseHeaders
    91  }
    92  
    93  type ListRequestBody struct {
    94  	ownerID *refs.OwnerID
    95  }
    96  
    97  type ListRequest struct {
    98  	body *ListRequestBody
    99  
   100  	session.RequestHeaders
   101  }
   102  
   103  type ListResponseBody struct {
   104  	cidList []refs.ContainerID
   105  }
   106  
   107  type ListResponse struct {
   108  	body *ListResponseBody
   109  
   110  	session.ResponseHeaders
   111  }
   112  
   113  type SetExtendedACLRequestBody struct {
   114  	eacl *acl.Table
   115  
   116  	sig *refs.Signature
   117  }
   118  
   119  type SetExtendedACLRequest struct {
   120  	body *SetExtendedACLRequestBody
   121  
   122  	session.RequestHeaders
   123  }
   124  
   125  type SetExtendedACLResponseBody struct{}
   126  
   127  type SetExtendedACLResponse struct {
   128  	body *SetExtendedACLResponseBody
   129  
   130  	session.ResponseHeaders
   131  }
   132  
   133  type GetExtendedACLRequestBody struct {
   134  	cid *refs.ContainerID
   135  }
   136  
   137  type GetExtendedACLRequest struct {
   138  	body *GetExtendedACLRequestBody
   139  
   140  	session.RequestHeaders
   141  }
   142  
   143  type GetExtendedACLResponseBody struct {
   144  	eacl *acl.Table
   145  
   146  	sig *refs.Signature
   147  
   148  	token *session.Token
   149  }
   150  
   151  type GetExtendedACLResponse struct {
   152  	body *GetExtendedACLResponseBody
   153  
   154  	session.ResponseHeaders
   155  }
   156  
   157  type UsedSpaceAnnouncement struct {
   158  	epoch uint64
   159  
   160  	cid *refs.ContainerID
   161  
   162  	usedSpace uint64
   163  }
   164  
   165  type AnnounceUsedSpaceRequestBody struct {
   166  	announcements []UsedSpaceAnnouncement
   167  }
   168  
   169  type AnnounceUsedSpaceRequest struct {
   170  	body *AnnounceUsedSpaceRequestBody
   171  
   172  	session.RequestHeaders
   173  }
   174  
   175  type AnnounceUsedSpaceResponseBody struct{}
   176  
   177  type AnnounceUsedSpaceResponse struct {
   178  	body *AnnounceUsedSpaceResponseBody
   179  
   180  	session.ResponseHeaders
   181  }
   182  
   183  func (a *Attribute) GetKey() string {
   184  	if a != nil {
   185  		return a.key
   186  	}
   187  
   188  	return ""
   189  }
   190  
   191  func (a *Attribute) SetKey(v string) {
   192  	a.key = v
   193  }
   194  
   195  func (a *Attribute) GetValue() string {
   196  	if a != nil {
   197  		return a.val
   198  	}
   199  
   200  	return ""
   201  }
   202  
   203  func (a *Attribute) SetValue(v string) {
   204  	a.val = v
   205  }
   206  
   207  func (c *Container) GetVersion() *refs.Version {
   208  	if c != nil {
   209  		return c.version
   210  	}
   211  
   212  	return nil
   213  }
   214  
   215  func (c *Container) SetVersion(v *refs.Version) {
   216  	c.version = v
   217  }
   218  
   219  func (c *Container) GetOwnerID() *refs.OwnerID {
   220  	if c != nil {
   221  		return c.ownerID
   222  	}
   223  
   224  	return nil
   225  }
   226  
   227  func (c *Container) SetOwnerID(v *refs.OwnerID) {
   228  	c.ownerID = v
   229  }
   230  
   231  func (c *Container) GetNonce() []byte {
   232  	if c != nil {
   233  		return c.nonce
   234  	}
   235  
   236  	return nil
   237  }
   238  
   239  func (c *Container) SetNonce(v []byte) {
   240  	c.nonce = v
   241  }
   242  
   243  func (c *Container) GetBasicACL() uint32 {
   244  	if c != nil {
   245  		return c.basicACL
   246  	}
   247  
   248  	return 0
   249  }
   250  
   251  func (c *Container) SetBasicACL(v uint32) {
   252  	c.basicACL = v
   253  }
   254  
   255  func (c *Container) GetAttributes() []Attribute {
   256  	if c != nil {
   257  		return c.attr
   258  	}
   259  
   260  	return nil
   261  }
   262  
   263  func (c *Container) SetAttributes(v []Attribute) {
   264  	c.attr = v
   265  }
   266  
   267  func (c *Container) GetPlacementPolicy() *netmap.PlacementPolicy {
   268  	if c != nil {
   269  		return c.policy
   270  	}
   271  
   272  	return nil
   273  }
   274  
   275  func (c *Container) SetPlacementPolicy(v *netmap.PlacementPolicy) {
   276  	c.policy = v
   277  }
   278  
   279  func (r *PutRequestBody) GetContainer() *Container {
   280  	if r != nil {
   281  		return r.cnr
   282  	}
   283  
   284  	return nil
   285  }
   286  
   287  func (r *PutRequestBody) SetContainer(v *Container) {
   288  	r.cnr = v
   289  }
   290  
   291  func (r *PutRequestBody) GetSignature() *refs.Signature {
   292  	if r != nil {
   293  		return r.sig
   294  	}
   295  
   296  	return nil
   297  }
   298  
   299  func (r *PutRequestBody) SetSignature(v *refs.Signature) {
   300  	// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
   301  	v.SetScheme(0)
   302  	r.sig = v
   303  }
   304  
   305  func (r *PutRequest) GetBody() *PutRequestBody {
   306  	if r != nil {
   307  		return r.body
   308  	}
   309  
   310  	return nil
   311  }
   312  
   313  func (r *PutRequest) SetBody(v *PutRequestBody) {
   314  	r.body = v
   315  }
   316  
   317  func (r *PutResponseBody) GetContainerID() *refs.ContainerID {
   318  	if r != nil {
   319  		return r.cid
   320  	}
   321  
   322  	return nil
   323  }
   324  
   325  func (r *PutResponseBody) SetContainerID(v *refs.ContainerID) {
   326  	r.cid = v
   327  }
   328  
   329  func (r *PutResponse) GetBody() *PutResponseBody {
   330  	if r != nil {
   331  		return r.body
   332  	}
   333  
   334  	return nil
   335  }
   336  
   337  func (r *PutResponse) SetBody(v *PutResponseBody) {
   338  	r.body = v
   339  }
   340  
   341  func (r *GetRequestBody) GetContainerID() *refs.ContainerID {
   342  	if r != nil {
   343  		return r.cid
   344  	}
   345  
   346  	return nil
   347  }
   348  
   349  func (r *GetRequestBody) SetContainerID(v *refs.ContainerID) {
   350  	r.cid = v
   351  }
   352  
   353  func (r *GetRequest) GetBody() *GetRequestBody {
   354  	if r != nil {
   355  		return r.body
   356  	}
   357  
   358  	return nil
   359  }
   360  
   361  func (r *GetRequest) SetBody(v *GetRequestBody) {
   362  	r.body = v
   363  }
   364  
   365  func (r *GetResponseBody) GetContainer() *Container {
   366  	if r != nil {
   367  		return r.cnr
   368  	}
   369  
   370  	return nil
   371  }
   372  
   373  func (r *GetResponseBody) SetContainer(v *Container) {
   374  	r.cnr = v
   375  }
   376  
   377  // GetSessionToken returns token of the session within which requested
   378  // container was created.
   379  func (r *GetResponseBody) GetSessionToken() *session.Token {
   380  	if r != nil {
   381  		return r.token
   382  	}
   383  
   384  	return nil
   385  }
   386  
   387  // SetSessionToken sets token of the session within which requested
   388  // container was created.
   389  func (r *GetResponseBody) SetSessionToken(v *session.Token) {
   390  	r.token = v
   391  }
   392  
   393  // GetSignature returns signature of the requested container.
   394  func (r *GetResponseBody) GetSignature() *refs.Signature {
   395  	if r != nil {
   396  		return r.sig
   397  	}
   398  
   399  	return nil
   400  }
   401  
   402  // SetSignature sets signature of the requested container.
   403  func (r *GetResponseBody) SetSignature(v *refs.Signature) {
   404  	// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
   405  	v.SetScheme(0)
   406  	r.sig = v
   407  }
   408  
   409  func (r *GetResponse) GetBody() *GetResponseBody {
   410  	if r != nil {
   411  		return r.body
   412  	}
   413  
   414  	return nil
   415  }
   416  
   417  func (r *GetResponse) SetBody(v *GetResponseBody) {
   418  	r.body = v
   419  }
   420  
   421  func (r *DeleteRequestBody) GetContainerID() *refs.ContainerID {
   422  	if r != nil {
   423  		return r.cid
   424  	}
   425  
   426  	return nil
   427  }
   428  
   429  func (r *DeleteRequestBody) SetContainerID(v *refs.ContainerID) {
   430  	r.cid = v
   431  }
   432  
   433  func (r *DeleteRequestBody) GetSignature() *refs.Signature {
   434  	if r != nil {
   435  		return r.sig
   436  	}
   437  
   438  	return nil
   439  }
   440  
   441  func (r *DeleteRequestBody) SetSignature(v *refs.Signature) {
   442  	// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
   443  	v.SetScheme(0)
   444  	r.sig = v
   445  }
   446  
   447  func (r *DeleteRequest) GetBody() *DeleteRequestBody {
   448  	if r != nil {
   449  		return r.body
   450  	}
   451  
   452  	return nil
   453  }
   454  
   455  func (r *DeleteRequest) SetBody(v *DeleteRequestBody) {
   456  	r.body = v
   457  }
   458  
   459  func (r *DeleteResponse) GetBody() *DeleteResponseBody {
   460  	if r != nil {
   461  		return r.body
   462  	}
   463  
   464  	return nil
   465  }
   466  
   467  func (r *DeleteResponse) SetBody(v *DeleteResponseBody) {
   468  	r.body = v
   469  }
   470  
   471  func (r *ListRequestBody) GetOwnerID() *refs.OwnerID {
   472  	if r != nil {
   473  		return r.ownerID
   474  	}
   475  
   476  	return nil
   477  }
   478  
   479  func (r *ListRequestBody) SetOwnerID(v *refs.OwnerID) {
   480  	r.ownerID = v
   481  }
   482  
   483  func (r *ListRequest) GetBody() *ListRequestBody {
   484  	if r != nil {
   485  		return r.body
   486  	}
   487  
   488  	return nil
   489  }
   490  
   491  func (r *ListRequest) SetBody(v *ListRequestBody) {
   492  	r.body = v
   493  }
   494  
   495  func (r *ListResponseBody) GetContainerIDs() []refs.ContainerID {
   496  	if r != nil {
   497  		return r.cidList
   498  	}
   499  
   500  	return nil
   501  }
   502  
   503  func (r *ListResponseBody) SetContainerIDs(v []refs.ContainerID) {
   504  	r.cidList = v
   505  }
   506  
   507  func (r *ListResponse) GetBody() *ListResponseBody {
   508  	if r != nil {
   509  		return r.body
   510  	}
   511  
   512  	return nil
   513  }
   514  
   515  func (r *ListResponse) SetBody(v *ListResponseBody) {
   516  	r.body = v
   517  }
   518  
   519  func (r *SetExtendedACLRequestBody) GetEACL() *acl.Table {
   520  	if r != nil {
   521  		return r.eacl
   522  	}
   523  
   524  	return nil
   525  }
   526  
   527  func (r *SetExtendedACLRequestBody) SetEACL(v *acl.Table) {
   528  	r.eacl = v
   529  }
   530  
   531  func (r *SetExtendedACLRequestBody) GetSignature() *refs.Signature {
   532  	if r != nil {
   533  		return r.sig
   534  	}
   535  
   536  	return nil
   537  }
   538  
   539  func (r *SetExtendedACLRequestBody) SetSignature(v *refs.Signature) {
   540  	// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
   541  	v.SetScheme(0)
   542  	r.sig = v
   543  }
   544  
   545  func (r *SetExtendedACLRequest) GetBody() *SetExtendedACLRequestBody {
   546  	if r != nil {
   547  		return r.body
   548  	}
   549  
   550  	return nil
   551  }
   552  
   553  func (r *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequestBody) {
   554  	r.body = v
   555  }
   556  
   557  func (r *SetExtendedACLResponse) GetBody() *SetExtendedACLResponseBody {
   558  	if r != nil {
   559  		return r.body
   560  	}
   561  
   562  	return nil
   563  }
   564  
   565  func (r *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponseBody) {
   566  	r.body = v
   567  }
   568  
   569  func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID {
   570  	if r != nil {
   571  		return r.cid
   572  	}
   573  
   574  	return nil
   575  }
   576  
   577  func (r *GetExtendedACLRequestBody) SetContainerID(v *refs.ContainerID) {
   578  	r.cid = v
   579  }
   580  
   581  func (r *GetExtendedACLRequest) GetBody() *GetExtendedACLRequestBody {
   582  	if r != nil {
   583  		return r.body
   584  	}
   585  
   586  	return nil
   587  }
   588  
   589  func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) {
   590  	r.body = v
   591  }
   592  
   593  func (r *GetExtendedACLResponseBody) GetEACL() *acl.Table {
   594  	if r != nil {
   595  		return r.eacl
   596  	}
   597  
   598  	return nil
   599  }
   600  
   601  func (r *GetExtendedACLResponseBody) SetEACL(v *acl.Table) {
   602  	r.eacl = v
   603  }
   604  
   605  func (r *GetExtendedACLResponseBody) GetSignature() *refs.Signature {
   606  	if r != nil {
   607  		return r.sig
   608  	}
   609  
   610  	return nil
   611  }
   612  
   613  func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) {
   614  	// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
   615  	v.SetScheme(0)
   616  	r.sig = v
   617  }
   618  
   619  // GetSessionToken returns token of the session within which requested
   620  // eACL table was set.
   621  func (r *GetExtendedACLResponseBody) GetSessionToken() *session.Token {
   622  	if r != nil {
   623  		return r.token
   624  	}
   625  
   626  	return nil
   627  }
   628  
   629  // SetSessionToken sets token of the session within which requested
   630  // eACL table was set.
   631  func (r *GetExtendedACLResponseBody) SetSessionToken(v *session.Token) {
   632  	r.token = v
   633  }
   634  
   635  func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody {
   636  	if r != nil {
   637  		return r.body
   638  	}
   639  
   640  	return nil
   641  }
   642  
   643  func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) {
   644  	r.body = v
   645  }
   646  
   647  func (a *UsedSpaceAnnouncement) GetEpoch() uint64 {
   648  	if a != nil {
   649  		return a.epoch
   650  	}
   651  
   652  	return 0
   653  }
   654  
   655  func (a *UsedSpaceAnnouncement) SetEpoch(v uint64) {
   656  	a.epoch = v
   657  }
   658  
   659  func (a *UsedSpaceAnnouncement) GetUsedSpace() uint64 {
   660  	if a != nil {
   661  		return a.usedSpace
   662  	}
   663  
   664  	return 0
   665  }
   666  
   667  func (a *UsedSpaceAnnouncement) SetUsedSpace(v uint64) {
   668  	a.usedSpace = v
   669  }
   670  
   671  func (a *UsedSpaceAnnouncement) GetContainerID() *refs.ContainerID {
   672  	if a != nil {
   673  		return a.cid
   674  	}
   675  
   676  	return nil
   677  }
   678  
   679  func (a *UsedSpaceAnnouncement) SetContainerID(v *refs.ContainerID) {
   680  	a.cid = v
   681  }
   682  
   683  func (r *AnnounceUsedSpaceRequestBody) GetAnnouncements() []UsedSpaceAnnouncement {
   684  	if r != nil {
   685  		return r.announcements
   686  	}
   687  
   688  	return nil
   689  }
   690  
   691  func (r *AnnounceUsedSpaceRequestBody) SetAnnouncements(v []UsedSpaceAnnouncement) {
   692  	r.announcements = v
   693  }
   694  
   695  func (r *AnnounceUsedSpaceRequest) GetBody() *AnnounceUsedSpaceRequestBody {
   696  	if r != nil {
   697  		return r.body
   698  	}
   699  
   700  	return nil
   701  }
   702  
   703  func (r *AnnounceUsedSpaceRequest) SetBody(v *AnnounceUsedSpaceRequestBody) {
   704  	r.body = v
   705  }
   706  
   707  func (r *AnnounceUsedSpaceResponse) GetBody() *AnnounceUsedSpaceResponseBody {
   708  	if r != nil {
   709  		return r.body
   710  	}
   711  
   712  	return nil
   713  }
   714  
   715  func (r *AnnounceUsedSpaceResponse) SetBody(v *AnnounceUsedSpaceResponseBody) {
   716  	r.body = v
   717  }