models

package
v0.6.10 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandMask

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 GUnzippedBytes

func GUnzippedBytes(input []byte) ([]byte, error)

GUnzippedBytes uncompresses a slice of bytes.

func ValidateMask

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.
	RecommendedDeployment string    // Recommended API deployment.
	Labels                []byte    // Serialized labels.
	Annotations           []byte    // Serialized annotations.
	ParentProjectKey      string
	ParentProject         *Project `gorm:"foreignKey:ParentProjectKey;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

Api is the storage-side representation of an API.

func NewApi

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

NewApi initializes a new resource.

func (*Api) LabelsMap

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

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 an api using the contents of a message.

type Artifact

type Artifact struct {
	Key          string    `gorm:"primaryKey"`
	ProjectID    string    // Project associated with artifact (required).
	ApiID        string    `gorm:"index"` // Api associated with artifact (if appropriate).
	VersionID    string    // Version associated with artifact (if appropriate).
	SpecID       string    // Spec associated with artifact (if appropriate).
	RevisionID   string    // Revision associated with parent (if appropriate).
	DeploymentID string    // Deployment 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.
	Labels       []byte    // Serialized labels.
	Annotations  []byte    // Serialized annotations.
}

Artifact is the storage-side representation of an artifact.

func NewArtifact

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

NewArtifact initializes a new resource.

func (*Artifact) LabelsMap added in v0.5.7

func (artifact *Artifact) LabelsMap() (map[string]string, error)

LabelsMap returns a map representation of stored labels.

func (*Artifact) Message

func (artifact *Artifact) Message() (message *rpc.Artifact, err error)

Message returns an RPC message representing the artifact.

func (*Artifact) Name

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 of an API.
	SpecID       string    // Uniquely identifies a spec of a version.
	RevisionID   string    // Uniquely identifies a revision of a spec.
	DeploymentID string    // Uniquely identifies a deployment of an API.
	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

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 Deployment added in v0.3.9

type Deployment struct {
	Key                string    `gorm:"primaryKey"`
	ProjectID          string    // Uniquely identifies a project.
	ApiID              string    `gorm:"index"` // Uniquely identifies an api within a project.
	DeploymentID       string    // Uniquely identifies a deployment within an api.
	RevisionID         string    // Uniquely identifies a revision of a deployment.
	DisplayName        string    // A human-friendly name.
	Description        string    // A detailed description.
	CreateTime         time.Time // Creation time.
	RevisionCreateTime time.Time // Revision creation time.
	RevisionUpdateTime time.Time // Time of last change.
	ApiSpecRevision    string    // The spec being served by the deployment.
	EndpointURI        string    // The address where the deployment is serving.
	ExternalChannelURI string    // The address of the external channel of the API.
	IntendedAudience   string    // The intended audience of the API.
	AccessGuidance     string    // A brief description of how to access the endpoint.
	Labels             []byte    // Serialized labels.
	Annotations        []byte    // Serialized annotations.
	ParentApiKey       string
	ParentApi          *Api `gorm:"foreignKey:ParentApiKey;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

Deployment is the storage-side representation of a deployment.

func NewDeployment added in v0.3.9

func NewDeployment(name names.Deployment, body *rpc.ApiDeployment) (deployment *Deployment, err error)

NewDeployment initializes a new resource.

func (*Deployment) BasicMessage added in v0.3.9

func (s *Deployment) BasicMessage(name string) (message *rpc.ApiDeployment, err error)

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

func (*Deployment) LabelsMap added in v0.3.9

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

LabelsMap returns a map representation of stored labels.

func (*Deployment) Name added in v0.3.9

func (s *Deployment) Name() string

Name returns the resource name of the deployment.

func (*Deployment) NewRevision added in v0.3.9

func (s *Deployment) NewRevision() *Deployment

NewRevision returns a new revision based on the deployment.

func (*Deployment) RevisionName added in v0.3.9

func (s *Deployment) RevisionName() string

RevisionName generates the resource name of the deployment revision.

func (*Deployment) Update added in v0.3.9

func (s *Deployment) Update(message *rpc.ApiDeployment, mask *fieldmaskpb.FieldMask) error

Update modifies a deployment using the contents of a message.

type DeploymentRevisionTag added in v0.3.9

type DeploymentRevisionTag struct {
	Key                 string    `gorm:"primaryKey"`
	ProjectID           string    // Uniquely identifies a project.
	ApiID               string    // Uniquely identifies an api within a project.
	DeploymentID        string    // Uniquely identifies a deployment within an api.
	RevisionID          string    // Uniquely identifies a revision of a deployment.
	Tag                 string    // The tag to use for the revision.
	CreateTime          time.Time // Creation time.
	UpdateTime          time.Time // Time of last change.
	ParentDeploymentKey string
	ParentDeployment    *Deployment `gorm:"foreignKey:ParentDeploymentKey;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

DeploymentRevisionTag is the storage-side representation of a deployment revision tag.

func NewDeploymentRevisionTag added in v0.3.9

func NewDeploymentRevisionTag(name names.DeploymentRevision, tag string) *DeploymentRevisionTag

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

func (*DeploymentRevisionTag) String added in v0.3.9

func (t *DeploymentRevisionTag) String() string

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

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

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    `gorm:"index"` // Uniquely identifies an api within a project.
	VersionID          string    // Uniquely identifies a version within an 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.
	ParentVersionKey   string
	ParentVersion      *Version `gorm:"foreignKey:ParentVersionKey;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

Spec is the storage-side representation of a spec.

func NewSpec

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

NewSpec initializes a new resource.

func (*Spec) BasicMessage

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

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

LabelsMap returns a map representation of stored labels.

func (*Spec) Name

func (s *Spec) Name() string

Name returns the resource name of the spec.

func (*Spec) NewRevision

func (s *Spec) NewRevision() *Spec

NewRevision returns a new revision based on the spec.

func (*Spec) RevisionName

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 an 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.
	ParentSpecKey string
	ParentSpec    *Spec `gorm:"foreignKey:ParentSpecKey;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

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

func NewSpecRevisionTag

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

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 within an 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.
	PrimarySpec  string    // Primary Spec for this version.
	ParentApiKey string
	ParentApi    *Api `gorm:"foreignKey:ParentApiKey;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

Version is the storage-side representation of a version.

func NewVersion

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

NewVersion initializes a new resource.

func (*Version) LabelsMap

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

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