models

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BlobEntityName = "Blob"

BlobEntityName is used to represent blobs in storage.

Variables

This section is empty.

Functions

func ExpandMask added in v0.3.0

ExpandMask returns a field mask for the given message following AIP-134 guidance. When the mask argument is nil, only populated (non-default) fields are included. When the mask argument only contains the wildcard character '*', every proto fields is included.

func ValidateMask added in v0.3.0

func ValidateMask(message protoreflect.ProtoMessage, mask *fieldmaskpb.FieldMask) error

ValidateMask returns an error if and only if the given mask does not follow AIP-134 guidance.

Types

type Api

type Api struct {
	Key                string    `gorm:"primaryKey"`
	ProjectID          string    // Uniquely identifies a project.
	ApiID              string    // Uniquely identifies an api within a project.
	DisplayName        string    // A human-friendly name.
	Description        string    // A detailed description.
	CreateTime         time.Time // Creation time.
	UpdateTime         time.Time // Time of last change.
	Availability       string    // Availability of the API.
	RecommendedVersion string    // Recommended API version.
	Labels             []byte    // Serialized labels.
	Annotations        []byte    // Serialized annotations.
}

Api is the storage-side representation of an API.

func NewApi added in v0.2.1

func NewApi(name names.Api, body *rpc.Api) (api *Api, err error)

NewApi initializes a new resource.

func (*Api) LabelsMap added in v0.2.0

func (api *Api) LabelsMap() (map[string]string, error)

LabelsMap returns a map representation of stored labels.

func (*Api) Message

func (api *Api) Message() (message *rpc.Api, err error)

Message returns a message representing an api.

func (*Api) Name added in v0.2.1

func (api *Api) Name() string

Name returns the resource name of the api.

func (*Api) Update

func (api *Api) Update(message *rpc.Api, mask *fieldmaskpb.FieldMask) error

Update modifies a api using the contents of a message.

type Artifact added in v0.2.0

type Artifact struct {
	Key         string    `gorm:"primaryKey"`
	ProjectID   string    // Project associated with artifact (required).
	ApiID       string    // Api associated with artifact (if appropriate).
	VersionID   string    // Version associated with artifact (if appropriate).
	SpecID      string    // Spec associated with artifact (if appropriate).
	ArtifactID  string    // Artifact identifier (required).
	CreateTime  time.Time // Creation time.
	UpdateTime  time.Time // Time of last change.
	MimeType    string    // MIME type of artifact
	SizeInBytes int32     // Size of the spec.
	Hash        string    // A hash of the spec.
}

Artifact is the storage-side representation of an artifact.

func NewArtifact added in v0.2.1

func NewArtifact(name names.Artifact, body *rpc.Artifact) *Artifact

NewArtifact initializes a new resource.

func (*Artifact) Message added in v0.2.0

func (artifact *Artifact) Message() *rpc.Artifact

Message returns an RPC message representing the artifact.

func (*Artifact) Name added in v0.2.1

func (artifact *Artifact) Name() string

Name returns the resource name of the artifact.

type Blob

type Blob struct {
	Key         string    `gorm:"primaryKey"`
	ProjectID   string    // Uniquely identifies a project.
	ApiID       string    // Uniquely identifies an api within a project.
	VersionID   string    // Uniquely identifies a version within a api.
	SpecID      string    // Uniquely identifies a spec within a version.
	RevisionID  string    // Uniquely identifies a revision of a spec.
	ArtifactID  string    // Uniquely identifies an artifact on a resource.
	Hash        string    // Hash of the blob contents.
	SizeInBytes int32     // Size of the blob contents.
	Contents    []byte    // The contents of the blob.
	CreateTime  time.Time // Creation time.
	UpdateTime  time.Time // Time of last change.
}

Blob is the storage-side representation of a blob.

func NewBlobForArtifact added in v0.2.0

func NewBlobForArtifact(artifact *Artifact, contents []byte) *Blob

NewBlobForArtifact creates a new Blob object to store artifact contents.

func NewBlobForSpec

func NewBlobForSpec(spec *Spec, contents []byte) *Blob

NewBlobForSpec creates a new Blob object to store spec contents.

type Project

type Project struct {
	Key         string    `gorm:"primaryKey"`
	ProjectID   string    // Uniquely identifies a project.
	DisplayName string    // A human-friendly name.
	Description string    // A detailed description.
	CreateTime  time.Time // Creation time.
	UpdateTime  time.Time // Time of last change.
}

Project is the storage-side representation of a project.

func NewProject added in v0.2.1

func NewProject(name names.Project, body *rpc.Project) *Project

NewProject initializes a new resource.

func (*Project) Message

func (p *Project) Message() *rpc.Project

Message returns a message representing a project.

func (*Project) Name added in v0.2.1

func (p *Project) Name() string

Name returns the resource name of the project.

func (*Project) Update

func (p *Project) Update(message *rpc.Project, mask *fieldmaskpb.FieldMask)

Update modifies a project using the contents of a message.

type Spec

type Spec struct {
	Key                string    `gorm:"primaryKey"`
	ProjectID          string    // Uniquely identifies a project.
	ApiID              string    // Uniquely identifies an api within a project.
	VersionID          string    // Uniquely identifies a version within a api.
	SpecID             string    // Uniquely identifies a spec within a version.
	RevisionID         string    // Uniquely identifies a revision of a spec.
	Description        string    // A detailed description.
	CreateTime         time.Time // Creation time.
	RevisionCreateTime time.Time // Revision creation time.
	RevisionUpdateTime time.Time // Time of last change.
	MimeType           string    // Spec format.
	SizeInBytes        int32     // Size of the spec.
	Hash               string    // A hash of the spec.
	FileName           string    // Name of spec file.
	SourceURI          string    // The original source URI of the spec.
	Labels             []byte    // Serialized labels.
	Annotations        []byte    // Serialized annotations.
}

Spec is the storage-side representation of a spec.

func NewSpec added in v0.2.1

func NewSpec(name names.Spec, body *rpc.ApiSpec) (spec *Spec, err error)

NewSpec initializes a new resource.

func (*Spec) BasicMessage added in v0.2.1

func (s *Spec) BasicMessage(name string) (message *rpc.ApiSpec, err error)

BasicMessage returns the basic view of the spec resource as an RPC message.

func (*Spec) LabelsMap added in v0.2.0

func (s *Spec) LabelsMap() (map[string]string, error)

LabelsMap returns a map representation of stored labels.

func (*Spec) Name added in v0.2.1

func (s *Spec) Name() string

Name returns the resource name of the spec.

func (*Spec) NewRevision added in v0.2.1

func (s *Spec) NewRevision() *Spec

NewRevision returns a new revision based on the spec.

func (*Spec) RevisionName added in v0.2.1

func (s *Spec) RevisionName() string

RevisionName generates the resource name of the spec revision.

func (*Spec) Update

func (s *Spec) Update(message *rpc.ApiSpec, mask *fieldmaskpb.FieldMask) error

Update modifies a spec using the contents of a message.

type SpecRevisionTag

type SpecRevisionTag struct {
	Key        string    `gorm:"primaryKey"`
	ProjectID  string    // Uniquely identifies a project.
	ApiID      string    // Uniquely identifies an api within a project.
	VersionID  string    // Uniquely identifies a version within a api.
	SpecID     string    // Uniquely identifies a spec within a version.
	RevisionID string    // Uniquely identifies a revision of a spec.
	Tag        string    // The tag to use for the revision.
	CreateTime time.Time // Creation time.
	UpdateTime time.Time // Time of last change.
}

SpecRevisionTag is the storage-side representation of a spec revision tag.

func NewSpecRevisionTag added in v0.2.1

func NewSpecRevisionTag(name names.SpecRevision, tag string) *SpecRevisionTag

NewSpecRevisionTag initializes a new revision tag from a given revision name and tag string.

func (*SpecRevisionTag) String added in v0.2.1

func (t *SpecRevisionTag) String() string

type Version

type Version struct {
	Key         string    `gorm:"primaryKey"`
	ProjectID   string    // Uniquely identifies a project.
	ApiID       string    // Uniquely identifies an api within a project.
	VersionID   string    // Uniquely identifies a version wihtin a api.
	DisplayName string    // A human-friendly name.
	Description string    // A detailed description.
	CreateTime  time.Time // Creation time.
	UpdateTime  time.Time // Time of last change.
	State       string    // Lifecycle stage.
	Labels      []byte    // Serialized labels.
	Annotations []byte    // Serialized annotations.
}

Version is the storage-side representation of a version.

func NewVersion added in v0.2.1

func NewVersion(name names.Version, body *rpc.ApiVersion) (version *Version, err error)

NewVersion initializes a new resource.

func (*Version) LabelsMap added in v0.2.0

func (v *Version) LabelsMap() (map[string]string, error)

LabelsMap returns a map representation of stored labels.

func (*Version) Message

func (v *Version) Message() (message *rpc.ApiVersion, err error)

Message returns a message representing a version.

func (*Version) Name added in v0.2.1

func (v *Version) Name() string

Name returns the resource name of the version.

func (*Version) Update

func (v *Version) Update(message *rpc.ApiVersion, mask *fieldmaskpb.FieldMask) error

Update modifies a version using the contents of a message.

Jump to

Keyboard shortcuts

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