models

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: MIT Imports: 11 Imported by: 0

README

models package

The intent of this package is to have the base models that are used throughout all other packages. It's easy to end up with ugly import cycle issues when these models are sprinkled throughout other packages.

These models should remain simple structs and corresponding functions hanging off of those structs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashData

func HashData(data string) string

HashData returns the SHA256 hash of the environment data.

Types

type App

type App struct {
	ID           string                `json:"id"`
	AlternateId  string                `json:"alternateId"`
	Name         string                `json:"name"`
	Organization OrganizationReference `json:"organization"`
	Project      ProjectReference      `json:"project"`
}

type AppReference

type AppReference struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	AlternateID string `json:"alternateId"`
}

type Artifact

type Artifact struct {
	Type  string `json:"type"`
	Image struct {
		URI string `json:"uri"`
	} `json:"image"`
	Ports []int `json:"ports"`
}

type AzureContainerRegistryConfiguration

type AzureContainerRegistryConfiguration struct {
	RegistryId   string `json:"registryId"`
	RegistryName string `json:"registryName"`
	TenantId     string `json:"tenantId"`
	Secrets      struct {
		Auth struct {
			Server            string `json:"server"`
			Username          string `json:"username"`
			EncryptedPassword string `json:"encryptedPassword"`
		} `json:"auth"`
	} `json:"secrets"`
}

type Build

type Build struct {
	Id                 string                                  `json:"id"`
	Organization       OrganizationReference                   `json:"organization"`
	Project            ProjectReference                        `json:"project"`
	ProjectEnvironment ProjectEnvironmentWithWildCardReference `json:"projectEnvironment"`
	App                AppReference                            `json:"app"`
	Tags               []string                                `json:"tags;omitempty"`
	CommitSha          string                                  `json:"commitSha"`
	Artifact           Artifact                                `json:"artifact"`
}

type Condition

type Condition struct {
	ConnectedAccounts *ConnectedAccounts `json:"connectedAccounts,omitempty"`
	ID                string             `json:"id,omitempty"`
	OrganizationID    string             `json:"organization.id,omitempty"`
}

type ConnectedAccounts

type ConnectedAccounts struct {
	ElemMatch *ElemMatch `json:"$elemMatch"`
}

type Connection

type Connection[T AzureContainerRegistryConfiguration] struct {
	Id                      string                            `json:"id"`
	Type                    string                            `json:"type"`
	Entity                  ConnectionEntity                  `json:"entity"`
	OrganizationIntegration ConnectionOrganizationIntegration `json:"organizationIntegration"`
	Config                  T                                 `json:"config"`
	Status                  string                            `json:"status"`
	Organization            OrganizationReference             `json:"organization"`
	Project                 ProjectReference                  `json:"project"`
}

type ConnectionEntity

type ConnectionEntity struct {
	Id   string `json:"id"`
	Type string `json:"type"`
	Name string `json:"name"`
}

type ConnectionOrganizationIntegration

type ConnectionOrganizationIntegration struct {
	Id   string `json:"id"`
	Type string `json:"type"`
}

type ContainerRegistry

type ContainerRegistry struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Url  string `json:"url"`
	Auth struct {
		Server   string `json:"server"`
		Username string `json:"username"`
		Password string `json:"password"`
	} `json:"auth"`
}

type Deployment

type Deployment struct {
	ID           string                `json:"id"`
	Name         string                `json:"name"`
	Description  string                `json:"description"`
	Organization OrganizationReference `json:"organization"`
	Apps         []DeploymentApp       `json:"apps"`
}

type DeploymentApp

type DeploymentApp struct {
	Project            ProjectReference      `json:"project"`
	App                AppReference          `json:"app"`
	DeploymentSettings DeploymentAppSettings `json:"deploymentSettings"`
}

type DeploymentAppSettings

type DeploymentAppSettings struct {
	ProjectEnvironment ProjectEnvironmentReference `json:"projectEnvironment"`
	Scale              string                      `json:"scale"`
	Hostname           string                      `json:"hostname"`
	Availability       string                      `json:"availability"`
	Path               string                      `json:"path"`
}

type DeploymentPipeline

type DeploymentPipeline struct {
	Steps []DeploymentStep `json:"steps"`
}

type DeploymentRun

type DeploymentRun struct {
	ID                 string                `json:"id"`
	Status             string                `json:"status"`
	DeploymentId       string                `json:"deploymentId"`
	DeploymentSnapshot Deployment            `json:"deploymentSnapshot"`
	Organization       OrganizationReference `json:"organization"`
	Pipeline           DeploymentPipeline    `json:"pipeline"`
}

type DeploymentStep

type DeploymentStep struct {
	ID            string           `json:"id"`
	Status        string           `json:"status"`
	Type          string           `json:"type"`
	Name          string           `json:"name"`
	ParallelSteps []DeploymentStep `json:"parallelSteps,omitempty"`
	Tasks         []DeploymentTask `json:"tasks,omitempty"`
}

type DeploymentTask

type DeploymentTask struct {
	ID     string `json:"id"`
	Status string `json:"status"`
	Type   string `json:"type"`
}

type ElemMatch

type ElemMatch struct {
	Type       string `json:"type"`
	Identifier string `json:"identifier"`
}

type Env

type Env struct {
	Size           string                       `json:"size"`
	CountVariables int                          `json:"countVariables"`
	Data           string                       `json:"data"`
	ID             *string                      `json:"id,omitempty"`
	Version        *int                         `json:"version,omitempty"`
	ProjectEnv     *ProjectEnvironmentReference `json:"projectEnvironment,omitempty"`
	SecretKeyID    *int64                       `json:"secretKeyId,omitempty"`
	Published      *time.Time                   `json:"published,omitempty"`
}

func (*Env) DecryptData

func (e *Env) DecryptData(secret Secret) (string, error)

func (*Env) DecryptVarsAndSaveIntoFile

func (e *Env) DecryptVarsAndSaveIntoFile(fileName string, secret Secret) (string, error)

func (*Env) EncryptData

func (e *Env) EncryptData(secret Secret) (string, error)

func (*Env) HashData

func (e *Env) HashData() string

type Environment

type Environment struct {
	ID           string                `json:"id"`
	AlternateID  string                `json:"alternateId"`
	Name         string                `json:"name"`
	Color        string                `json:"color"`
	Organization OrganizationReference `json:"organization"`
	Project      ProjectReference      `json:"project"`
}

type ExecutionContext

type ExecutionContext struct {
	Request Request `json:"request"`
	User    User    `json:"user"`
	Member  Member  `json:"member"`
}

type Member

type Member struct {
	ID           string                `json:"id"`
	Name         string                `json:"name"`
	Email        string                `json:"email"`
	Organization OrganizationReference `json:"organization"`
	Rules        []Rule                `json:"rules"`
}

type NewBuild

type NewBuild struct {
	Tags      []string `json:"tags"`
	CommitSha string   `json:"commitSha"`
	Artifact  Artifact `json:"artifact"`
}

type Organization

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

type OrganizationReference

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

type PaginatedResponse

type PaginatedResponse[T any] struct {
	Data     []T `json:"data"`
	PageNum  int `json:"pageNum,omitempty"`
	PageSize int `json:"pageSize,omitempty"`
	Total    int `json:"total,omitempty"`
}

type Project

type Project struct {
	ID          *string `json:"id,omitempty"`
	AlternateID string  `json:"alternateId"`
	Name        string  `json:"name"`
	IsMonorepo  bool    `json:"isMonorepo"`
}

type ProjectEnvironmentReference

type ProjectEnvironmentReference struct {
	ID          string `json:"id"`
	AlternateID string `json:"alternateId"`
	Name        string `json:"name"`
}

type ProjectEnvironmentWithWildCardReference

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

type ProjectReference

type ProjectReference struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	AlternateID string `json:"alternateId"`
}

type Request

type Request struct {
	ID            string `json:"id"`
	CausationID   string `json:"causationId"`
	CorrelationID string `json:"correlationId"`
}

type Rule

type Rule struct {
	Action     string     `json:"action"`
	Subject    string     `json:"subject"`
	Conditions *Condition `json:"conditions,omitempty"`
}

type Secret

type Secret struct {
	SecretKeyId     int64  `json:"secret_key_id"`
	Base64SecretKey string `json:"secret_key"`
}

func GenerateSecret

func GenerateSecret() (Secret, error)

GenerateSecret creates a new Secret with a randomly generated key

func NewSecret

func NewSecret(secretBase64 string) Secret

NewSecret creates a new Secret from a base64 encoded secret key

func (Secret) Base64

func (s Secret) Base64() string

Base64 returns the base64 encoded secret key

func (Secret) Decrypt

func (s Secret) Decrypt(encryptedMessage string) (string, error)

Decrypt decrypts an encrypted message using AES decryption

func (Secret) Encrypt

func (s Secret) Encrypt(message string) (string, error)

Encrypt encrypts a message using AES encryption

func (Secret) HashSHA

func (s Secret) HashSHA() (string, error)

HashSHA returns the SHA256 hash of the secret key

type User

type User struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Rules []Rule `json:"rules"`
	Type  string `json:"type"`
}

Jump to

Keyboard shortcuts

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