dto

package
v1.0.0-alpha1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyDataProductRequest

func ApplyDataProductRequest(dst *model.DataProduct, src *DataProductRequest)

ApplyDataProductRequest copies the mutable fields of a request onto an entity. The owner, the provision status and the creation time are never written from a request.

func ApplySCPDataStorageRequest

func ApplySCPDataStorageRequest(dst *model.SCPDataStorage, src *SCPDataStorageRequest)

ApplySCPDataStorageRequest copies the mutable fields of a request onto an entity. The key is resolved by the service, which is what turns an unknown id into a 404 rather than a dangling reference.

An omitted port means 22 rather than 0 — the zero value would be a port nothing can connect to, which is worse than a default.

func ApplyVirtualDataDirectoryRequest

func ApplyVirtualDataDirectoryRequest(dst *model.VirtualDataDirectory, src *VirtualDataDirectoryRequest)

ApplyVirtualDataDirectoryRequest copies the mutable fields of a request onto an entity. The owner and the creation time are never written from a request.

func ApplyVirtualDataFileRequest

func ApplyVirtualDataFileRequest(dst *model.VirtualDataFile, src *VirtualDataFileRequest)

ApplyVirtualDataFileRequest copies the mutable fields of a request onto an entity.

Types

type DataProductRequest

type DataProductRequest struct {
	DataName        *string                `json:"dataName"`
	DataDescription *string                `json:"dataDescription"`
	IsFile          *bool                  `json:"isFile"`
	Path            *string                `json:"path"`
	DataStorageID   string                 `json:"dataStorageId"`
	DataStorageType *model.DataStorageType `json:"dataStorageType"`
}

DataProductRequest is the create/update payload for a registered dataset.

There is no owner field and no provision status: ownership comes from the access token, and the lifecycle state is the server's to move. A caller who could set either would be able to register a dataset as someone else's, or claim it was already provisioned.

func (*DataProductRequest) StorageType

func (r *DataProductRequest) StorageType() model.DataStorageType

StorageType returns the requested storage type, defaulting to SCP — the only kind there is so far, and the only kind dataStorageId can resolve against.

func (*DataProductRequest) Validate

func (r *DataProductRequest) Validate() []httpx.FieldError

Validate implements httpx.Validator.

type DataProductResponse

type DataProductResponse struct {
	DataID          string                 `json:"dataId"`
	DataName        *string                `json:"dataName"`
	DataDescription *string                `json:"dataDescription"`
	IsFile          bool                   `json:"isFile"`
	Path            *string                `json:"path"`
	ProvisionStatus *model.ProvisionStatus `json:"provisionStatus"`
	OwnerID         *string                `json:"ownerId"`
	DataStorageID   *string                `json:"dataStorageId"`
	DataStorageType model.DataStorageType  `json:"dataStorageType"`
	CreatedAt       int64                  `json:"createdAt"`

	Permission *string `json:"permission,omitempty"`
}

DataProductResponse is the read model for a registered dataset.

Permission is what the calling principal may do with it — WRITE for the owner and for admins, otherwise whatever the strongest share reaching them grants. It is a property of the request rather than of the record, which is why it is not stored.

func ToDataProductResponse

func ToDataProductResponse(p *model.DataProduct) DataProductResponse

func ToDataProductResponseWith

func ToDataProductResponseWith(p *model.DataProduct, permission string) DataProductResponse

ToDataProductResponseWith is ToDataProductResponse with the caller's effective permission attached.

func ToDataProductResponses

func ToDataProductResponses(in []model.DataProduct) []DataProductResponse

type SCPDataStorageRequest

type SCPDataStorageRequest struct {
	DataName *string `json:"dataName"`

	HostName string `json:"hostName"`
	Port     *int   `json:"port"`

	LoginUser string `json:"loginUser"`

	SSHCredentialID string `json:"sshCredentialId"`
}

SCPDataStorageRequest is the create/update payload for a storage.

There is no owner field: ownership comes from the access token and is immutable, so a storage can neither be registered on someone else's behalf nor handed over by editing it.

func (*SCPDataStorageRequest) Validate

func (r *SCPDataStorageRequest) Validate() []httpx.FieldError

Validate implements httpx.Validator.

type SCPDataStorageResponse

type SCPDataStorageResponse struct {
	DataID   string  `json:"dataId"`
	DataName *string `json:"dataName"`
	OwnerID  *string `json:"ownerId"`

	HostName *string `json:"hostName"`
	Port     *int    `json:"port"`

	LoginUser *string `json:"loginUser"`

	SSHCredentialID *string                        `json:"sshCredentialId"`
	SSHCredential   *creddto.SSHCredentialResponse `json:"sshCredential"`

	Permission *string `json:"permission,omitempty"`
}

SCPDataStorageResponse is the read model for a storage.

The host and the account it is reached as are spelled out on the storage itself; the key is inlined as its safe summary — name and public key, never the private material, which the credential response type has no field for at all.

func ToSCPDataStorageResponse

func ToSCPDataStorageResponse(s *model.SCPDataStorage) SCPDataStorageResponse

func ToSCPDataStorageResponseWith

func ToSCPDataStorageResponseWith(s *model.SCPDataStorage, permission string) SCPDataStorageResponse

ToSCPDataStorageResponseWith is ToSCPDataStorageResponse with the caller's effective permission attached.

func ToSCPDataStorageResponses

func ToSCPDataStorageResponses(in []model.SCPDataStorage) []SCPDataStorageResponse

type VirtualDataDirectoryRequest

type VirtualDataDirectoryRequest struct {
	DirectoryName     *string `json:"directoryName"`
	ParentDirectoryID *string `json:"parentDirectoryId"`
	DataProductID     *string `json:"dataProductId"`
}

VirtualDataDirectoryRequest is the create/update payload for a directory node.

There is no owner field: ownership comes from the access token at creation and is never rewritten, so a caller cannot register a dataset as someone else's.

ParentDirectoryID is how a node is placed, and changing it on an update moves the node. A nil parent means a root — the top of a new dataset. An update replaces the whole node, as everywhere else in this API, so a caller renaming a nested directory has to send its parent back with the new name; leaving the field out asks for a root, and the node is moved out to become one.

DataProductID is set only on a directory standing for a registered directory product; a plain container leaves it nil and holds children instead.

func (*VirtualDataDirectoryRequest) Name

Name returns the requested name. Validation has already rejected a nil or blank one.

func (*VirtualDataDirectoryRequest) Validate

Validate implements httpx.Validator.

type VirtualDataDirectoryResponse

type VirtualDataDirectoryResponse struct {
	VirtualDataDirectoryID string  `json:"virtualDataDirectoryId"`
	DirectoryName          *string `json:"directoryName"`
	ParentDirectoryID      *string `json:"parentDirectoryId"`
	DataProductID          *string `json:"dataProductId"`
	OwnerID                *string `json:"ownerId"`
	CreatedAt              int64   `json:"createdAt"`

	Permission *string `json:"permission,omitempty"`

	Files       *[]VirtualDataFileResponse      `json:"virtualDataFiles,omitempty"`
	Directories *[]VirtualDataDirectoryResponse `json:"virtualDataDirectories,omitempty"`
}

VirtualDataDirectoryResponse is the read model for a directory node.

Permission is what the calling principal may do with it: WRITE for the owner and for admins, otherwise whatever the strongest share reaching this node or any ancestor grants. It is a property of the request rather than of the record.

func ToVirtualDataDirectoryResponseWith

func ToVirtualDataDirectoryResponseWith(d *model.VirtualDataDirectory, permission string) VirtualDataDirectoryResponse

ToVirtualDataDirectoryResponseWith is ToVirtualDataDirectoryResponse with the caller's effective permission attached.

type VirtualDataFileRequest

type VirtualDataFileRequest struct {
	FileName          *string `json:"fileName"`
	ParentDirectoryID string  `json:"parentDirectoryId"`
	DataProductID     string  `json:"dataProductId"`
}

VirtualDataFileRequest is the create/update payload for a leaf.

Both references are required: a file is a product placed under a directory, and it is nothing without either half.

func (*VirtualDataFileRequest) Name

func (r *VirtualDataFileRequest) Name() string

Name returns the requested name. Validation has already rejected a nil or blank one.

func (*VirtualDataFileRequest) Validate

func (r *VirtualDataFileRequest) Validate() []httpx.FieldError

Validate implements httpx.Validator.

type VirtualDataFileResponse

type VirtualDataFileResponse struct {
	VirtualDataFileID string  `json:"virtualDataFileId"`
	FileName          *string `json:"fileName"`
	ParentDirectoryID *string `json:"parentDirectoryId"`
	DataProductID     *string `json:"dataProductId"`
	CreatedAt         int64   `json:"createdAt"`

	Permission *string `json:"permission,omitempty"`
}

VirtualDataFileResponse is the read model for a leaf. Permission is inherited from the directory the file sits under, since a file carries no shares of its own.

func ToVirtualDataFileResponseWith

func ToVirtualDataFileResponseWith(f *model.VirtualDataFile, permission string) VirtualDataFileResponse

ToVirtualDataFileResponseWith is ToVirtualDataFileResponse with the caller's effective permission attached.

func ToVirtualDataFileResponsesWith

func ToVirtualDataFileResponsesWith(in []model.VirtualDataFile, permission string) []VirtualDataFileResponse

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL