v1serializers

package
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildResponse

type BuildResponse struct {
	ID            int             `json:"id"`
	VersionString string          `json:"version_string"`
	CommitSha     string          `json:"commit_sha"`
	BuildURL      string          `json:"build_url,omitempty"`
	BuiltAt       time.Time       `json:"built_at,omitempty"`
	Service       ServiceResponse `json:"service"`
}

BuildResponse is the type used to ensure that response bodies from the /builds api group have a consistent structure

type BuildSerializer

type BuildSerializer struct {
	Build v1models.Build
}

BuildSerializer takes a Build model entity and translates it into a response

func (*BuildSerializer) Response

func (bs *BuildSerializer) Response() BuildResponse

Response method performs the serialization from a Build entity to BuildsResponse

type BuildsResponse

type BuildsResponse struct {
	Builds []BuildResponse `json:"builds"`
	Error  string          `json:"error,omitempty"`
}

BuildsResponse is a type that allows all data returned from the /builds api group to share a consistent structure

type BuildsSerializer

type BuildsSerializer struct {
	Builds []v1models.Build
}

BuildsSerializer is used to transform a slice of builds into the BuildsResponse type

func (*BuildsSerializer) Response

func (bs *BuildsSerializer) Response() []BuildResponse

Response transforms a list of build model entities into BuildResponse's

type DeployResponse

type DeployResponse struct {
	ID              int                     `json:"id"`
	ServiceInstance ServiceInstanceResponse `json:"service_instance"`
	Build           BuildResponse           `json:"build"`
	CreatedAt       time.Time               `json:"deployed_at"`
}

DeployResponse is the type used for generating api responses containing information about deploy(s)

type DeploysResponse

type DeploysResponse struct {
	Deploys []DeployResponse `json:"deploys"`
	Error   string           `json:"error,omitempty"`
}

DeploysResponse is a type that allows all data returned from the /builds api group to share a consistent structure

type DeploysSerializer

type DeploysSerializer struct {
	Deploys []v1models.Deploy
}

DeploysSerializer is used to transform a slice of Deploy models into into deploy responses and can supply additional data to attach to the response

func (*DeploysSerializer) Response

func (ds *DeploysSerializer) Response() []DeployResponse

DeploysResponse is used to seralize a slice of deploy database models into a slice of deploy api responses

type EnvironmentResponse

type EnvironmentResponse struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

EnvironmentResponse is the type that environment entities are serialized to and used in responses to clients

type EnvironmentSerializer

type EnvironmentSerializer struct {
	Environment v1models.Environment
}

func (*EnvironmentSerializer) Response

type EnvironmentsSerializer

type EnvironmentsSerializer struct {
	Environments []v1models.Environment
}

EnvironmentsSerializer is used to convert a list of environment model types to a Respopnse type used to send environment info to clients

func (*EnvironmentsSerializer) Response

Response is a function that Serializers a slice of Environment models to responses suitable for sending to clients

type Response

type Response struct {
	Services []ServiceResponse `json:"services"`
	Error    string            `json:"error,omitempty"`
}

Response is a type that allows all data returned from the /service api group to share a consistent structure

type ServiceInstanceResponse

type ServiceInstanceResponse struct {
	ID          int                 `json:"id"`
	Service     ServiceResponse     `json:"service"`
	Environment EnvironmentResponse `json:"environment"`
}

ServiceInstanceResponse is the type that is used to represent data about a ServiceInstance entity in response to clients. Its purpose is to decouple responses from the database model

type ServiceInstanceSerializer

type ServiceInstanceSerializer struct {
	// contains filtered or unexported fields
}

ServiceInstanceSerializer is an intermediate type used to convert a Service instance into its response type

func (*ServiceInstanceSerializer) Response

DeploysResponse consumes a ServiceInstanceSerializer and generated a response type

type ServiceInstancesSerializer

type ServiceInstancesSerializer struct {
	ServiceInstances []v1models.ServiceInstance
}

ServiceInstancesSerializer is a wrapper around ServiceInstanceSerializer that supports serialization of mulitple ServiceInstance entities

func (*ServiceInstancesSerializer) Response

DeploysResponse Will generate a slice of Service Instance DeploysResponse from ServiceInstancesSerializer

type ServiceResponse

type ServiceResponse struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	RepoURL string `json:"repo_url"`
}

ServiceResponse is the type used to serialize Service data that is returned to clients of the sherlock api

type ServiceSerializer

type ServiceSerializer struct {
	Service v1models.Service
}

ServiceSerializer is used to serializer a single Service model to a used to generate responses from the /services api group

func (*ServiceSerializer) Response

func (ss *ServiceSerializer) Response() ServiceResponse

Response takes a Service Model entity and transforms it into a ServiceResponse

type ServicesSerializer

type ServicesSerializer struct {
	Services []v1models.Service
}

ServicesSerializer is used to serialize a ServiceModel entity to a a format used in http response bodies

func (*ServicesSerializer) Response

func (ss *ServicesSerializer) Response() []ServiceResponse

Response serializes Service models into Service Responses

Jump to

Keyboard shortcuts

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