model

package
v0.0.0-...-066e387 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Available          string = "available"
	InProgress         string = "in_progress"
	PartiallyAvailable string = "partially_available"
	Unavailable        string = "unavailable"
)

Availability statuses.

View Source
const (
	AppMetaData      = "AppMetaData"
	SuperKeyMetaData = "SuperKeyMetaData"
)
View Source
const (
	AccountAuth  string = "account_authorization"
	ManualConfig string = "manual_configuration"
)

App creation workflow's constants

View Source
const CategoryCloud = "Cloud"
View Source
const CategoryDeveloperSources = "Developer sources"
View Source
const CategoryRedhat = "Red Hat"
View Source
const UserOwnership = "user"

Variables

View Source
var AvailabilityStatuses = []string{
	"",
	Available,
	InProgress,
	PartiallyAvailable,
	Unavailable,
}

AvailabilityStatuses contains the possible valid values of the status of a source

View Source
var ErrBadSecretStore = fmt.Errorf("invalid secret-store, check the SECRET_STORE environment variable. needs to be one of [database, secrets-manager, vault]")
View Source
var ValidAvailabilityStatuses = map[string]struct{}{
	Available:          {},
	InProgress:         {},
	PartiallyAvailable: {},
	Unavailable:        {},
}

ValidAvailabilityStatuses is a map containing the valid availability statuses. It has this form because a map is faster for these lookups.

View Source
var ValidEndpointAvailabilityStatuses = map[string]struct{}{
	Available:   {},
	Unavailable: {},
}

ValidEndpointAvailabilityStatuses is a map containing the valid availability statuses for the endpoints. It has this form because a map is faster for these lookups.

Functions

func UpdateMessage

func UpdateMessage(eventObject EventModelDao, resource util.Resource, attributes []string) ([]byte, error)

Types

type Application

type Application struct {
	ID        int64      `gorm:"primarykey" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	PausedAt  *time.Time `json:"paused_at"`

	AvailabilityStatus      string     `gorm:"default:in_progress;not null" json:"availability_status,omitempty"`
	LastCheckedAt           *time.Time `json:"last_checked_at,omitempty"`
	LastAvailableAt         *time.Time `json:"last_available_at,omitempty"`
	AvailabilityStatusError string     `json:"availability_status_error,omitempty"`

	Extra             datatypes.JSON `json:"extra,omitempty"`
	RetryCounter      *int8          `json:"-" gorm:"default:0"`
	SuperkeyData      datatypes.JSON `json:"-"`
	GotSuperkeyUpdate bool           `json:"-" gorm:"-"`

	TenantID int64
	Tenant   Tenant
	UserID   *int64 `json:"user_id"`
	User     User

	SourceID int64 `json:"source_id"`
	Source   Source

	ApplicationTypeID int64 `json:"application_type_id"`
	ApplicationType   ApplicationType

	ApplicationAuthentications []ApplicationAuthentication
}

func (*Application) ToEmail

func (app *Application) ToEmail(previousStatus string) *EmailNotificationInfo

func (*Application) ToEvent

func (app *Application) ToEvent() interface{}

func (*Application) ToResponse

func (app *Application) ToResponse() *ApplicationResponse

func (*Application) UpdateFromRequest

func (app *Application) UpdateFromRequest(req *ApplicationEditRequest)

func (*Application) UpdateFromRequestPaused

func (app *Application) UpdateFromRequestPaused(req *ResourceEditPausedRequest) error

type ApplicationAuthentication

type ApplicationAuthentication struct {
	ID        int64      `gorm:"primarykey" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	PausedAt  *time.Time `json:"paused_at"`

	VaultPath string `json:"vault_path" gorm:"-"`

	TenantID int64
	Tenant   Tenant
	UserID   *int64
	User     User

	ApplicationID int64 `json:"application_id"`
	Application   Application
	// TODO: fix correctly PR#40
	AuthenticationID int64 `json:"-"`

	AuthenticationUID string `json:"-" gorm:"-"`
}

func (*ApplicationAuthentication) ToEvent

func (aa *ApplicationAuthentication) ToEvent() interface{}

func (*ApplicationAuthentication) ToResponse

type ApplicationAuthenticationCreateRequest

type ApplicationAuthenticationCreateRequest struct {
	ApplicationIDRaw    interface{} `json:"application_id"`
	AuthenticationIDRaw interface{} `json:"authentication_id"`
	ApplicationID       int64       `json:"-"`
	AuthenticationID    int64       `json:"-"`
}

type ApplicationAuthenticationEvent

type ApplicationAuthenticationEvent struct {
	ID        int64   `json:"id"`
	CreatedAt *string `json:"created_at"`
	UpdatedAt *string `json:"updated_at"`
	PausedAt  *string `json:"paused_at"`

	ApplicationID    int64 `json:"application_id"`
	AuthenticationID int64 `json:"authentication_id"`
	// TODO: maybe add back in if we get vault
	AuthenticationUID string `json:"-"`

	Tenant *string `json:"tenant"`
	// TODO: add back in if we get vault
	VaultPath string `json:"-"`
}

type ApplicationAuthenticationResponse

type ApplicationAuthenticationResponse struct {
	ID        string `json:"id"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`

	ApplicationID     string `json:"application_id"`
	AuthenticationID  string `json:"authentication_id"`
	AuthenticationUID string `json:"-"`
}

type ApplicationCreateRequest

type ApplicationCreateRequest struct {
	Extra datatypes.JSON `json:"extra,omitempty"`

	SourceID             int64       `json:"-"`
	SourceIDRaw          interface{} `json:"source_id"`
	ApplicationTypeID    int64       `json:"-"`
	ApplicationTypeIDRaw interface{} `json:"application_type_id"`
}

type ApplicationEditRequest

type ApplicationEditRequest struct {
	Extra map[string]interface{} `json:"extra,omitempty"`

	AvailabilityStatus      *string `json:"availability_status"`
	AvailabilityStatusError *string `json:"availability_status_error"`

	// TODO: remove these once satellite goes away.
	LastCheckedAt   *string `json:"last_checked_at"`
	LastAvailableAt *string `json:"last_available_at"`
}

type ApplicationEvent

type ApplicationEvent struct {
	ID        int64   `json:"id"`
	CreatedAt *string `json:"created_at"`
	UpdatedAt *string `json:"updated_at"`
	PausedAt  *string `json:"paused_at"`

	AvailabilityStatus      *string        `json:"availability_status"`
	LastCheckedAt           *string        `json:"last_checked_at"`
	LastAvailableAt         *string        `json:"last_available_at"`
	AvailabilityStatusError *string        `json:"availability_status_error"`
	Extra                   datatypes.JSON `json:"extra"`
	SuperkeyData            datatypes.JSON `json:"superkey_data"`

	SourceID          int64   `json:"source_id"`
	ApplicationTypeID int64   `json:"application_type_id"`
	Tenant            *string `json:"tenant"`
}

type ApplicationResponse

type ApplicationResponse struct {
	ID        string `json:"id"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
	PausedAt  string `json:"paused_at,omitempty"`

	AvailabilityStatus      *string        `json:"availability_status,omitempty"`
	LastCheckedAt           string         `json:"last_checked_at,omitempty"`
	LastAvailableAt         string         `json:"last_available_at,omitempty"`
	AvailabilityStatusError string         `json:"availability_status_error,omitempty"`
	Extra                   datatypes.JSON `json:"extra,omitempty"`

	SourceID          string `json:"source_id"`
	ApplicationTypeID string `json:"application_type_id"`
}

type ApplicationType

type ApplicationType struct {
	//fields for gorm
	Id        int64     `gorm:"primarykey" json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	Name                         string         `json:"name"`
	DisplayName                  string         `json:"display_name"`
	DependentApplications        datatypes.JSON `json:"dependent_applications"`
	SupportedSourceTypes         datatypes.JSON `json:"supported_source_types"`
	SupportedAuthenticationTypes datatypes.JSON `json:"supported_authentication_types"`
	ResourceOwnership            *string        `json:"resource_ownership"`

	Applications []Application
	Sources      []*Source `gorm:"many2many:applications;"`
	MetaData     []MetaData
}

func (*ApplicationType) AvailabilityCheckURL

func (at *ApplicationType) AvailabilityCheckURL() *url.URL

AvailabilityCheckURL returns the application's availability check URL, e.g. where to send the request for the client to re-check the application's availability status.

func (*ApplicationType) ToResponse

func (a *ApplicationType) ToResponse() *ApplicationTypeResponse

func (*ApplicationType) UserResourceOwnership

func (at *ApplicationType) UserResourceOwnership() bool

type ApplicationTypeResponse

type ApplicationTypeResponse struct {
	//fields for gorm
	Id        string `json:"id"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`

	Name                         string         `json:"name"`
	DisplayName                  string         `json:"display_name"`
	DependentApplications        datatypes.JSON `json:"dependent_applications"`
	SupportedSourceTypes         datatypes.JSON `json:"supported_source_types"`
	SupportedAuthenticationTypes datatypes.JSON `json:"supported_authentication_types"`
}

type Authentication

type Authentication struct {
	DbID      int64     `gorm:"primaryKey; column:id" json:"-"`
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created_at" gorm:"-"`

	Name     *string `json:"name,omitempty"`
	AuthType string  `gorm:"column:authtype" json:"authtype"`
	Username *string `json:"username"`
	Version  string  `json:"version" gorm:"-"`

	// DO NOT set these fields directly, instead see secret_store_util.go for
	// interacting with store-specific fields.
	Password    *string                `json:"password_hash" gorm:"column:password_hash"`
	MiqPassword *string                `json:"password" gorm:"column:password"`
	Extra       map[string]interface{} `gorm:"-" json:"extra,omitempty"`
	ExtraDb     datatypes.JSON         `gorm:"column:extra"`

	AvailabilityStatus      *string    `gorm:"default:in_progress;not null" json:"availability_status,omitempty"`
	LastCheckedAt           *time.Time `json:"last_checked_at,omitempty"`
	LastAvailableAt         *time.Time `json:"last_available_at,omitempty"`
	AvailabilityStatusError *string    `json:"availability_status_error,omitempty"`

	SourceID int64 `json:"source_id"`
	Source   Source

	TenantID int64 `json:"tenant_id"`
	Tenant   Tenant
	UserID   *int64 `json:"user_id"`
	User     User

	ResourceType string `json:"resource_type"`
	ResourceID   int64  `json:"resource_id"`

	ApplicationAuthentications []ApplicationAuthentication
}

func (*Authentication) BulkMessage

func (auth *Authentication) BulkMessage() map[string]interface{}

func (*Authentication) GetExtra

func (auth *Authentication) GetExtra() map[string]interface{}

fetches the secret-store dependent extra field from the authentication

func (*Authentication) GetID

func (auth *Authentication) GetID() string

fetches the secret-store dependent ID from the authentication

func (*Authentication) GetPassword

func (auth *Authentication) GetPassword() (*string, error)

self-explanatory, the password can be in a different format based on the secret-store.

func (*Authentication) Path

func (auth *Authentication) Path() string

func (*Authentication) SetExtra

func (auth *Authentication) SetExtra(extra map[string]interface{}) error

set the extra field on the authentication struct based on which secret store we're using

func (*Authentication) SetExtraField

func (auth *Authentication) SetExtraField(key string, value interface{}) error

sets a field on the extra column, changing how to get to the field based on the secret store.

func (*Authentication) SetPassword

func (auth *Authentication) SetPassword(pass *string) error

func (*Authentication) ToEmail

func (auth *Authentication) ToEmail(previousStatus string) *EmailNotificationInfo

func (*Authentication) ToEvent

func (auth *Authentication) ToEvent() interface{}

func (*Authentication) ToInternalResponse

func (auth *Authentication) ToInternalResponse() *AuthenticationInternalResponse

func (*Authentication) ToInternalSecretResponse

func (auth *Authentication) ToInternalSecretResponse() *SecretInternalResponse

func (*Authentication) ToResponse

func (auth *Authentication) ToResponse() *AuthenticationResponse

func (*Authentication) ToSecretResponse

func (auth *Authentication) ToSecretResponse() *SecretResponse

func (*Authentication) ToVaultMap

func (auth *Authentication) ToVaultMap() (map[string]interface{}, error)

This method translates an Authentication struct to a hash that will be accepted by vault, this format will also be deserialized properly by dao.authFromVault, so if we are to add more fields they will need to be added here as well.

func (*Authentication) UpdateBy

func (auth *Authentication) UpdateBy(attributes map[string]interface{}) error

func (*Authentication) UpdateFromRequest

func (auth *Authentication) UpdateFromRequest(update *AuthenticationEditRequest) error

func (*Authentication) UpdateSecretFromRequest

func (auth *Authentication) UpdateSecretFromRequest(update *SecretEditRequest) error

type AuthenticationCreateRequest

type AuthenticationCreateRequest struct {
	Name                    *string                `json:"name,omitempty"`
	AuthType                string                 `json:"authtype"`
	Username                *string                `json:"username"`
	Password                *string                `json:"password,omitempty"`
	Extra                   map[string]interface{} `json:"extra,omitempty"`
	AvailabilityStatusError *string                `json:"availability_status_error,omitempty"`

	ResourceType  string      `json:"resource_type"`
	ResourceIDRaw interface{} `json:"resource_id"`
	ResourceID    int64       `json:"-"`
}

type AuthenticationEditRequest

type AuthenticationEditRequest struct {
	Name                    *string                 `json:"name"`
	AuthType                *string                 `json:"authtype"`
	Username                *string                 `json:"username"`
	Password                *string                 `json:"password,omitempty"`
	Extra                   *map[string]interface{} `json:"extra,omitempty"`
	AvailabilityStatus      *string                 `json:"availability_status,omitempty"`
	AvailabilityStatusError *string                 `json:"availability_status_error,omitempty"`
}

type AuthenticationEvent

type AuthenticationEvent struct {
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created_at"`

	Name                    string                 `json:"name"`
	AuthType                string                 `json:"authtype"`
	Username                string                 `json:"username"`
	Extra                   map[string]interface{} `json:"extra"`
	Version                 string                 `json:"version"`
	AvailabilityStatus      *string                `json:"availability_status"`
	LastCheckedAt           *string                `json:"last_checked_at"`
	LastAvailableAt         *string                `json:"last_available_at"`
	AvailabilityStatusError *string                `json:"availability_status_error"`
	ResourceType            string                 `json:"resource_type"`
	ResourceID              int64                  `json:"resource_id"`
	SourceID                int64                  `json:"source_id"`
	Tenant                  *string                `json:"tenant"`
}

type AuthenticationInternalResponse

type AuthenticationInternalResponse struct {
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"created_at"`

	Name                    string                 `json:"name,omitempty"`
	AuthType                string                 `json:"authtype"`
	Username                string                 `json:"username"`
	Password                string                 `json:"password,omitempty"`
	Extra                   map[string]interface{} `json:"extra,omitempty"`
	Version                 string                 `json:"version"`
	AvailabilityStatus      string                 `json:"availability_status,omitempty"`
	AvailabilityStatusError string                 `json:"availability_status_error,omitempty"`

	ResourceType string `json:"resource_type"`
	ResourceID   string `json:"resource_id"`
}

type AuthenticationResponse

type AuthenticationResponse struct {
	ID string `json:"id"`

	Name                    string                 `json:"name,omitempty"`
	AuthType                string                 `json:"authtype"`
	Username                string                 `json:"username"`
	Extra                   map[string]interface{} `json:"extra,omitempty"`
	AvailabilityStatus      string                 `json:"availability_status,omitempty"`
	AvailabilityStatusError string                 `json:"availability_status_error,omitempty"`

	ResourceType string `json:"resource_type"`
	ResourceID   string `json:"resource_id"`
}

type BulkCreateApplication

type BulkCreateApplication struct {
	ApplicationCreateRequest

	ApplicationTypeName string `json:"application_type_name"`
	SourceName          string `json:"source_name"`
}

type BulkCreateAuthentication

type BulkCreateAuthentication struct {
	AuthenticationCreateRequest

	ResourceName string `json:"resource_name"`
}

type BulkCreateEndpoint

type BulkCreateEndpoint struct {
	EndpointCreateRequest

	SourceName string `json:"source_name"`
}

type BulkCreateOutput

type BulkCreateOutput struct {
	Sources                    []Source
	Applications               []Application
	Endpoints                  []Endpoint
	Authentications            []Authentication
	ApplicationAuthentications []ApplicationAuthentication
}

Output from the BulkCreate operation - stores the parsed resources that have been validated.

func (BulkCreateOutput) ToResponse

func (b BulkCreateOutput) ToResponse() *BulkCreateResponse

type BulkCreateRequest

type BulkCreateRequest struct {
	Sources         []BulkCreateSource         `json:"sources"`
	Applications    []BulkCreateApplication    `json:"applications"`
	Endpoints       []BulkCreateEndpoint       `json:"endpoints"`
	Authentications []BulkCreateAuthentication `json:"authentications"`
}

Bulk Create Request is a request creating 1..n resources in Sources API which does all of the linking between resources automatically.

This outer request just contains slices of the possible resources that can be created.

type BulkCreateResponse

type BulkCreateResponse struct {
	Sources         []SourceResponse         `json:"sources"`
	Applications    []ApplicationResponse    `json:"applications"`
	Endpoints       []EndpointResponse       `json:"endpoints"`
	Authentications []AuthenticationResponse `json:"authentications"`
}

type BulkCreateSource

type BulkCreateSource struct {
	SourceCreateRequest

	SourceTypeName string `json:"source_type_name"`
}

type EmailNotification

type EmailNotification interface {
	ToEmail(previousStatus string) *EmailNotificationInfo
}

type EmailNotificationInfo

type EmailNotificationInfo struct {
	ResourceDisplayName        string `json:"resource_display_name"`
	CurrentAvailabilityStatus  string `json:"current_availability_status"`
	PreviousAvailabilityStatus string `json:"previous_availability_status"`
	SourceID                   string `json:"source_id"`
	SourceName                 string `json:"source_name"`
	TenantID                   string `json:"tenant_id"`
}

type Endpoint

type Endpoint struct {
	ID        int64      `gorm:"primarykey" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	PausedAt  *time.Time `json:"paused_at"`

	Role                 *string `json:"role,omitempty"`
	Port                 *int    `json:"port,omitempty"`
	Default              *bool   `json:"default,omitempty"`
	Scheme               *string `json:"scheme,omitempty"`
	Host                 *string `json:"host,omitempty"`
	Path                 *string `json:"path,omitempty"`
	VerifySsl            *bool   `json:"verify_ssl,omitempty"`
	CertificateAuthority *string `json:"certificate_authority,omitempty"`
	ReceptorNode         *string `json:"receptor_node,omitempty"`

	AvailabilityStatus      string     `gorm:"default:in_progress;not null" json:"availability_status,omitempty"`
	LastCheckedAt           *time.Time `json:"last_checked_at,omitempty"`
	LastAvailableAt         *time.Time `json:"last_available_at,omitempty"`
	AvailabilityStatusError *string    `json:"availability_status_error,omitempty"`

	SourceID int64 `json:"source_id"`
	Source   Source

	TenantID int64
	Tenant   Tenant
}

func (*Endpoint) ToEmail

func (endpoint *Endpoint) ToEmail(previousStatus string) *EmailNotificationInfo

func (*Endpoint) ToEvent

func (endpoint *Endpoint) ToEvent() interface{}

func (*Endpoint) ToResponse

func (endpoint *Endpoint) ToResponse() *EndpointResponse

func (*Endpoint) UpdateFromRequest

func (endpoint *Endpoint) UpdateFromRequest(req *EndpointEditRequest)

func (*Endpoint) UpdateFromRequestPaused

func (endpoint *Endpoint) UpdateFromRequestPaused(req *ResourceEditPausedRequest) error

type EndpointCreateRequest

type EndpointCreateRequest struct {
	Default              bool        `json:"default"`
	ReceptorNode         *string     `json:"receptor_node"`
	Role                 string      `json:"role"`
	Scheme               *string     `json:"scheme"`
	Host                 string      `json:"host"`
	Port                 *int        `json:"port"`
	Path                 string      `json:"path"`
	VerifySsl            *bool       `json:"verify_ssl"`
	CertificateAuthority *string     `json:"certificate_authority"`
	AvailabilityStatus   string      `json:"availability_status"`
	SourceID             int64       `json:"-"`
	SourceIDRaw          interface{} `json:"source_id"`
}

type EndpointEditRequest

type EndpointEditRequest struct {
	Default                 *bool   `json:"default,omitempty"`
	ReceptorNode            *string `json:"receptor_node,omitempty"`
	Role                    *string `json:"role,omitempty"`
	Scheme                  *string `json:"scheme,omitempty"`
	Host                    *string `json:"host,omitempty"`
	Port                    *int    `json:"port,omitempty"`
	Path                    *string `json:"path,omitempty"`
	VerifySsl               *bool   `json:"verify_ssl,omitempty"`
	CertificateAuthority    *string `json:"certificate_authority,omitempty"`
	AvailabilityStatus      *string `json:"availability_status,omitempty"`
	AvailabilityStatusError *string `json:"availability_status_error,omitempty"`

	// TODO: remove these once satellite goes away.
	LastCheckedAt   *string `json:"last_checked_at,omitempty"`
	LastAvailableAt *string `json:"last_available_at,omitempty"`
}

type EndpointEvent

type EndpointEvent struct {
	ID        int64   `json:"id"`
	CreatedAt *string `json:"created_at"`
	UpdatedAt *string `json:"updated_at"`
	PausedAt  *string `json:"paused_at"`

	Role                    *string `json:"role"`
	Port                    *int    `json:"port"`
	Default                 *bool   `json:"default"`
	Scheme                  *string `json:"scheme"`
	Host                    *string `json:"host"`
	Path                    *string `json:"path"`
	VerifySsl               *bool   `json:"verify_ssl"`
	CertificateAuthority    *string `json:"certificate_authority"`
	ReceptorNode            *string `json:"receptor_node"`
	AvailabilityStatus      *string `json:"availability_status"`
	LastCheckedAt           *string `json:"last_checked_at"`
	LastAvailableAt         *string `json:"last_available_at"`
	AvailabilityStatusError *string `json:"availability_status_error"`

	SourceID int64   `json:"source_id"`
	Tenant   *string `json:"tenant"`
}

type EndpointResponse

type EndpointResponse struct {
	ID        string `json:"id"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
	PausedAt  string `json:"paused_at,omitempty"`

	Role                    *string `json:"role,omitempty"`
	Port                    *int    `json:"port,omitempty"`
	Default                 *bool   `json:"default,omitempty"`
	Scheme                  *string `json:"scheme,omitempty"`
	Host                    *string `json:"host,omitempty"`
	Path                    *string `json:"path,omitempty"`
	VerifySsl               *bool   `json:"verify_ssl,omitempty"`
	CertificateAuthority    *string `json:"certificate_authority,omitempty"`
	ReceptorNode            *string `json:"receptor_node,omitempty"`
	AvailabilityStatus      *string `json:"availability_status,omitempty"`
	LastCheckedAt           string  `json:"last_checked_at,omitempty"`
	LastAvailableAt         string  `json:"last_available_at,omitempty"`
	AvailabilityStatusError *string `json:"availability_status_error,omitempty"`

	SourceID string `json:"source_id"`
}

type Event

type Event interface {
	ToEvent() interface{}
}

type EventModelDao

type EventModelDao interface {
	BulkMessage(resource util.Resource) (map[string]interface{}, error)
	FetchAndUpdateBy(resource util.Resource, updateAttributes map[string]interface{}) (interface{}, error)
	ToEventJSON(resource util.Resource) ([]byte, error)
}

type MetaData

type MetaData struct {
	ID        int64     `gorm:"primarykey" json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	Step          int            `json:"step"`
	Name          string         `json:"name"`
	Payload       datatypes.JSON `json:"payload"`
	Substitutions datatypes.JSON `json:"substitutions"`
	Type          string         `json:"type"`

	ApplicationTypeID int64 `json:"application_type_id"`
	ApplicationType   ApplicationType
}

func (*MetaData) RelationInfo

func (app *MetaData) RelationInfo() map[string]RelationSetting

func (*MetaData) ToResponse

func (app *MetaData) ToResponse() *MetaDataResponse

type MetaDataResponse

type MetaDataResponse struct {
	ID        string `json:"id"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`

	Name              string         `json:"name"`
	Payload           datatypes.JSON `json:"payload"`
	ApplicationTypeId string         `json:"application_type_id"`
}

type RelationObject

type RelationObject struct {
	Id              int64
	CurrentTenantID int64
	// contains filtered or unexported fields
}

func NewRelationObject

func NewRelationObject(objectModel interface{}, currentTenantID int64, query *gorm.DB) (RelationObject, error)

func (*RelationObject) HasMany

func (relationObject *RelationObject) HasMany(model interface{}, query *gorm.DB) *gorm.DB

func (*RelationObject) HasManyRelation

func (relationObject *RelationObject) HasManyRelation(query *gorm.DB, model interface{}) *gorm.DB

func (*RelationObject) HasManyThrough

func (relationObject *RelationObject) HasManyThrough(query *gorm.DB, model interface{}, throughTable string) *gorm.DB

func (*RelationObject) SelectStatementFor

func (relationObject *RelationObject) SelectStatementFor(query *gorm.DB, model interface{}) string

func (*RelationObject) StringBaseObject

func (relationObject *RelationObject) StringBaseObject() string

type RelationSetting

type RelationSetting struct {
	RelationType string
	Through      string
}

type ResourceEditPausedRequest

type ResourceEditPausedRequest struct {
	AvailabilityStatus      *string `json:"availability_status"`
	AvailabilityStatusError *string `json:"availability_status_error"`
	LastAvailableAt         *string `json:"last_available_at"`
	LastCheckedAt           *string `json:"last_checked_at"`
}

type RhcConnection

type RhcConnection struct {
	ID    int64          `gorm:"primaryKey" json:"id"`
	RhcId string         `json:"rhc_id"`
	Extra datatypes.JSON `json:"extra,omitempty"`

	AvailabilityStatus      string     `gorm:"default:in_progress;not null" json:"availability_status,omitempty"`
	LastCheckedAt           *time.Time `json:"last_checked_at,omitempty"`
	LastAvailableAt         *time.Time `json:"last_available_at,omitempty"`
	AvailabilityStatusError string     `json:"availability_status_error,omitempty"`
	CreatedAt               time.Time  `json:"created_at"`
	UpdatedAt               time.Time  `json:"updated_at"`

	Sources []Source `gorm:"many2many:source_rhc_connections"`
}

func (*RhcConnection) SourceIDs

func (r *RhcConnection) SourceIDs() []string

helper function to pull the source ids from the object.

func (*RhcConnection) ToEmail

func (r *RhcConnection) ToEmail(previousStatus string) *EmailNotificationInfo

func (*RhcConnection) ToEvent

func (r *RhcConnection) ToEvent() interface{}

func (*RhcConnection) ToResponse

func (r *RhcConnection) ToResponse() *RhcConnectionResponse

func (*RhcConnection) UpdateFromRequest

func (r *RhcConnection) UpdateFromRequest(input *RhcConnectionEditRequest)

type RhcConnectionCreateRequest

type RhcConnectionCreateRequest struct {
	RhcId       string         `json:"rhc_id"`
	Extra       datatypes.JSON `json:"extra"`
	SourceIdRaw interface{}    `json:"source_id"`
	SourceId    int64
}

RhcConnectionCreateRequest represents a request coming from the outside to create a Red Hat Connector connection.

type RhcConnectionEditRequest

type RhcConnectionEditRequest struct {
	Extra datatypes.JSON `json:"extra"`
}

RhcConnectionEditRequest represents a request coming from the outside to update a Red Hat Connector connection.

type RhcConnectionEvent

type RhcConnectionEvent struct {
	ID                      *string        `json:"id"`
	RhcId                   *string        `json:"rhc_id"`
	Extra                   datatypes.JSON `json:"extra"`
	AvailabilityStatus      *string        `json:"availability_status"`
	LastCheckedAt           *string        `json:"last_checked_at"`
	LastAvailableAt         *string        `json:"last_available_at"`
	AvailabilityStatusError *string        `json:"availability_status_error"`
	SourceIds               []string       `json:"source_ids"`

	CreatedAt *string `json:"created_at"`
	UpdatedAt *string `json:"updated_at"`
}

type RhcConnectionResponse

type RhcConnectionResponse struct {
	Id                      *string        `json:"id"`
	RhcId                   *string        `json:"rhc_id"`
	Extra                   datatypes.JSON `json:"extra,omitempty"`
	AvailabilityStatus      string         `json:"availability_status,omitempty"`
	LastCheckedAt           *time.Time     `json:"last_checked_at,omitempty"`
	LastAvailableAt         *time.Time     `json:"last_available_at,omitempty"`
	AvailabilityStatusError string         `json:"availability_status_error,omitempty"`
	SourceIds               []string       `json:"source_ids,omitempty"`
}

type SecretCreateRequest

type SecretCreateRequest struct {
	Name       *string                `json:"name,omitempty"`
	AuthType   string                 `json:"authtype"`
	Username   *string                `json:"username"`
	Password   *string                `json:"password,omitempty"`
	Extra      map[string]interface{} `json:"extra,omitempty"`
	UserScoped bool                   `json:"user_scoped"`
}

type SecretEditRequest

type SecretEditRequest struct {
	Username *string                 `json:"username"`
	Password *string                 `json:"password,omitempty"`
	Extra    *map[string]interface{} `json:"extra,omitempty"`
}

type SecretInternalResponse

type SecretInternalResponse struct {
	ID string `json:"id"`

	Name     string                 `json:"name,omitempty"`
	AuthType string                 `json:"authtype"`
	Username string                 `json:"username"`
	Extra    map[string]interface{} `json:"extra,omitempty"`
	Password string                 `json:"password,omitempty"`
}

type SecretResponse

type SecretResponse struct {
	ID string `json:"id"`

	Name     string                 `json:"name,omitempty"`
	AuthType string                 `json:"authtype"`
	Username string                 `json:"username"`
	Extra    map[string]interface{} `json:"extra,omitempty"`
}

type Source

type Source struct {
	AvailabilityStatus string     `gorm:"default:in_progress;not null" json:"availability_status,omitempty"`
	LastCheckedAt      *time.Time `json:"last_checked_at,omitempty"`
	LastAvailableAt    *time.Time `json:"last_available_at,omitempty"`

	//fields for gorm
	ID        int64      `gorm:"primarykey" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	PausedAt  *time.Time `json:"paused_at"`

	// standard source fields
	Name                string  `json:"name"`
	Uid                 *string `json:"uid,omitempty"`
	Version             *string `json:"version,omitempty"`
	Imported            *string `json:"imported,omitempty"`
	SourceRef           *string `json:"source_ref,omitempty"`
	AppCreationWorkflow string  `gorm:"default:manual_configuration" json:"app_creation_workflow"`

	SourceType   SourceType
	SourceTypeID int64 `json:"source_type_id"`

	Tenant   Tenant
	TenantID int64 `json:"tenant_id"`
	User     User
	UserID   *int64 `json:"user_id"`

	ApplicationTypes     []*ApplicationType `gorm:"many2many:applications"`
	Applications         []Application
	Endpoints            []Endpoint
	Authentications      []Authentication `gorm:"-"`
	SourceRhcConnections []SourceRhcConnection
}

Source struct that includes all of the fields on the table used internally for business logic

func (*Source) IsSuperkey

func (src *Source) IsSuperkey() bool

func (*Source) ToEmail

func (src *Source) ToEmail(previousStatus string) *EmailNotificationInfo

func (*Source) ToEvent

func (src *Source) ToEvent() interface{}

func (*Source) ToInternalResponse

func (src *Source) ToInternalResponse() *SourceInternalResponse

ToInternalResponse returns only the fields that "sources-monitor-go" requires.

func (*Source) ToResponse

func (src *Source) ToResponse() *SourceResponse

func (*Source) UpdateFromRequest

func (src *Source) UpdateFromRequest(update *SourceEditRequest)

func (*Source) UpdateFromRequestPaused

func (src *Source) UpdateFromRequestPaused(update *SourcePausedEditRequest) error

type SourceCreateRequest

type SourceCreateRequest struct {
	Name                *string `json:"name"`
	Uid                 *string `json:"uid,omitempty"`
	Version             *string `json:"version,omitempty"`
	Imported            *string `json:"imported,omitempty"`
	SourceRef           *string `json:"source_ref,omitempty"`
	AppCreationWorkflow string  `json:"app_creation_workflow"`
	AvailabilityStatus  string  `json:"availability_status"`

	SourceTypeID    *int64      `json:"-"`
	SourceTypeIDRaw interface{} `json:"source_type_id"`
}

SourceCreateRequest is a struct representing a request coming from the outside to create a struct, this is the way we will be marking fields as write-once. They are accepted on create but not edit.

type SourceEditRequest

type SourceEditRequest struct {
	Name               *string `json:"name"`
	Version            *string `json:"version,omitempty"`
	Imported           *string `json:"imported,omitempty"`
	SourceRef          *string `json:"source_ref,omitempty"`
	AvailabilityStatus *string `json:"availability_status"`

	// TODO: remove these once satellite goes away.
	LastCheckedAt   *string `json:"last_checked_at"`
	LastAvailableAt *string `json:"last_available_at"`
}

SourceEditRequest manages what we can/cannot update on the source object. Any extra params just will not serialize.

type SourceEvent

type SourceEvent struct {
	AvailabilityStatus *string `json:"availability_status"`
	LastCheckedAt      *string `json:"last_checked_at"`
	LastAvailableAt    *string `json:"last_available_at"`

	ID                  *int64  `json:"id"`
	CreatedAt           *string `json:"created_at"`
	UpdatedAt           *string `json:"updated_at"`
	PausedAt            *string `json:"paused_at"`
	Name                *string `json:"name"`
	UID                 *string `json:"uid"`
	Version             *string `json:"version"`
	Imported            *string `json:"imported"`
	SourceRef           *string `json:"source_ref"`
	AppCreationWorkflow *string `json:"app_creation_workflow"`
	SourceTypeID        *int64  `json:"source_type_id"`
	Tenant              *string `json:"tenant"`
}

type SourceInternalResponse

type SourceInternalResponse struct {
	Id                 *string `json:"id"`
	AvailabilityStatus *string `json:"availability_status"`
	ExternalTenant     *string `json:"tenant"`
	OrgId              *string `json:"org_id"`
}

SourceInternalResponse represents the structure we will return when a source is requested from the internal endpoint.

type SourcePausedEditRequest

type SourcePausedEditRequest struct {
	AvailabilityStatus *string `json:"availability_status"`
	LastAvailableAt    *string `json:"last_available_at"`
	LastCheckedAt      *string `json:"last_checked_at"`
}

SourcePausedEditRequest manages the payload we allow receiving when a paused source is tried to be edited.

type SourceResponse

type SourceResponse struct {
	AvailabilityStatus *string `json:"availability_status,omitempty"`
	LastCheckedAt      string  `json:"last_checked_at,omitempty"`
	LastAvailableAt    string  `json:"last_available_at,omitempty"`

	ID                  string  `json:"id"`
	CreatedAt           string  `json:"created_at"`
	UpdatedAt           string  `json:"updated_at"`
	PausedAt            string  `json:"paused_at,omitempty"`
	Name                *string `json:"name"`
	Uid                 *string `json:"uid,omitempty"`
	Version             *string `json:"version,omitempty"`
	Imported            *string `json:"imported,omitempty"`
	SourceRef           *string `json:"source_ref,omitempty"`
	AppCreationWorkflow *string `json:"app_creation_workflow"`

	SourceTypeId string `json:"source_type_id"`
}

SourceResponse represents what we will always return to the users of the API after a request.

type SourceRhcConnection

type SourceRhcConnection struct {
	SourceId int64 `gorm:"primaryKey"`

	RhcConnectionId int64 `gorm:"primaryKey"`
	RhcConnection   RhcConnection

	TenantId int64
	Tenant   Tenant
}

type SourceType

type SourceType struct {
	//fields for gorm
	Id        int64     `gorm:"primarykey" json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	Category     string            `json:"category"`
	Name         string            `json:"name"`
	ProductName  string            `json:"product_name"`
	Vendor       string            `json:"vendor"`
	IconUrl      string            `json:"icon_url"`
	Schema       datatypes.JSON    `json:"schema"`
	SchemaParsed *sourceTypeScheme `gorm:"-"`

	Sources []Source
}

func (*SourceType) SuperkeyAuthType

func (st *SourceType) SuperkeyAuthType() string

func (*SourceType) ToResponse

func (st *SourceType) ToResponse() *SourceTypeResponse

type SourceTypeResponse

type SourceTypeResponse struct {
	//fields for gorm
	Id        string `json:"id"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`

	Category    string         `json:"category"`
	Name        string         `json:"name"`
	ProductName string         `json:"product_name"`
	Vendor      string         `json:"vendor"`
	Schema      datatypes.JSON `json:"schema"`
	IconUrl     string         `json:"icon_url"`
}

type Tenant

type Tenant struct {
	Id             int64
	ExternalTenant string `gorm:"default:null"`
	OrgID          string `gorm:"default:null"`
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

Tenant represents the tenant object we will store on the database. The "external_tenant" and "org_id" columns have a "null" default value, so that Gorm inserts "null" when receiving an empty "AccountNumber" or "OrgId" value from an identity header. Empty values are considered when enforcing the "unique index" on those columns, whilst the "NULL"s are not considered.

func (Tenant) GetHeaders

func (t Tenant) GetHeaders() []kafka.Header

func (Tenant) GetHeadersWithGeneratedXRHID

func (t Tenant) GetHeadersWithGeneratedXRHID() []kafka.Header

type TenantTranslation

type TenantTranslation struct {
	Id             int64  `json:"id"`
	ExternalTenant string `json:"external_tenant"`
	OrgId          string `json:"org_id"`
	Error          error  `json:"error,omitempty"`
}

TenantTranslation is a struct which represents a tenant translation from "EBS account number" to "OrgId".

type User

type User struct {
	Id     int64  `gorm:"primarykey" json:"id"`
	UserID string `json:"user_id"`

	TenantID int64
	Tenant   Tenant

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type UserResource

type UserResource struct {
	SourceNames           []string
	ApplicationTypesNames []string
	User                  *User
}

func (*UserResource) AddSourceAndApplicationTypeNames

func (ur *UserResource) AddSourceAndApplicationTypeNames(sourceName, applicationTypeName string)

func (*UserResource) OwnershipPresentForApplication

func (ur *UserResource) OwnershipPresentForApplication(applicationTypeName string) bool

func (*UserResource) OwnershipPresentForSource

func (ur *UserResource) OwnershipPresentForSource(sourceName string) bool

func (*UserResource) OwnershipPresentForSourceAndApplication

func (ur *UserResource) OwnershipPresentForSourceAndApplication(sourceName, applicationTypeName string) bool

func (*UserResource) UserOwnershipActive

func (ur *UserResource) UserOwnershipActive() bool

Jump to

Keyboard shortcuts

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