Documentation ¶
Index ¶
- func ConvertAPIURL(apiURL, newPrefix, newPath string) (string, error)
- type Cluster
- type ClusterRepository
- type GormClusterRepository
- func (m *GormClusterRepository) CheckExists(ctx context.Context, id string) error
- func (m *GormClusterRepository) Create(ctx context.Context, c *Cluster) error
- func (m *GormClusterRepository) CreateOrSave(ctx context.Context, c *Cluster) error
- func (m *GormClusterRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (m *GormClusterRepository) FindByURL(ctx context.Context, url string) (*Cluster, error)
- func (m *GormClusterRepository) List(ctx context.Context, clusterType *string) ([]Cluster, error)
- func (m *GormClusterRepository) Load(ctx context.Context, id uuid.UUID) (*Cluster, error)
- func (m *GormClusterRepository) Query(funcs ...func(*gorm.DB) *gorm.DB) ([]Cluster, error)
- func (m *GormClusterRepository) Save(ctx context.Context, c *Cluster) error
- func (m *GormClusterRepository) TableName() string
- type GormIdentityClusterRepository
- func (m *GormIdentityClusterRepository) Create(ctx context.Context, c *IdentityCluster) error
- func (m *GormIdentityClusterRepository) Delete(ctx context.Context, identityID uuid.UUID, clusterURL string) error
- func (m *GormIdentityClusterRepository) ListClustersForIdentity(ctx context.Context, identityID uuid.UUID) ([]Cluster, error)
- func (m *GormIdentityClusterRepository) Load(ctx context.Context, identityID, clusterID uuid.UUID) (*IdentityCluster, error)
- func (m *GormIdentityClusterRepository) TableName() string
- type IdentityCluster
- type IdentityClusterRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAPIURL ¶
ConvertAPIURL converts the given `apiURL` by adding the new prefix (or subdomain) and a path eg: ConvertAPIURL("https://foo.com", "api", "some/path") gives "https://api.foo.com/some/path"
Types ¶
type Cluster ¶
type Cluster struct { gormsupport.LifecycleHardDelete // This is the primary key value ClusterID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key;column:cluster_id"` // The name of the cluster Name string `mapstructure:"name"` // API URL of the cluster URL string `sql:"unique_index" mapstructure:"api-url"` // Console URL of the cluster ConsoleURL string `mapstructure:"console-url" optional:"true"` // Optional in config file // Metrics URL of the cluster MetricsURL string `mapstructure:"metrics-url" optional:"true"` // Optional in config file // Logging URL of the cluster LoggingURL string `mapstructure:"logging-url" optional:"true"` // Optional in config file // Application host name used by the cluster AppDNS string `mapstructure:"app-dns"` // Service Account token (encrypted or not, depending on the state of the sibling SATokenEncrypted field) SAToken string `mapstructure:"service-account-token"` // Service Account username SAUsername string `mapstructure:"service-account-username"` // SA Token encrypted SATokenEncrypted bool `mapstructure:"service-account-token-encrypted" optional:"true" default:"true"` // Optional in config file // Token Provider ID TokenProviderID string `mapstructure:"token-provider-id"` // OAuthClient ID used to link users account AuthClientID string `mapstructure:"auth-client-id"` // OAuthClient secret used to link users account AuthClientSecret string `mapstructure:"auth-client-secret"` // OAuthClient default scope used to link users account AuthDefaultScope string `mapstructure:"auth-client-default-scope"` // Cluster type. Such as OSD, OSO, OCP, etc Type string `mapstructure:"type" optional:"true" default:"OSO"` // Optional in config file // cluster capacity exhausted by default false CapacityExhausted bool `mapstructure:"capacity-exhausted" optional:"true"` // Optional in config file }
Cluster the struct that holds the cluster info
type ClusterRepository ¶
type ClusterRepository interface { base.Exister Load(ctx context.Context, ID uuid.UUID) (*Cluster, error) Create(ctx context.Context, u *Cluster) error Save(ctx context.Context, u *Cluster) error CreateOrSave(ctx context.Context, u *Cluster) error Delete(ctx context.Context, ID uuid.UUID) error Query(funcs ...func(*gorm.DB) *gorm.DB) ([]Cluster, error) FindByURL(ctx context.Context, url string) (*Cluster, error) List(ctx context.Context, clusterType *string) ([]Cluster, error) }
ClusterRepository represents the storage interface.
func NewClusterRepository ¶
func NewClusterRepository(db *gorm.DB) ClusterRepository
NewClusterRepository creates a new storage type.
type GormClusterRepository ¶
type GormClusterRepository struct {
// contains filtered or unexported fields
}
GormClusterRepository is the implementation of the storage interface for Cluster.
func (*GormClusterRepository) CheckExists ¶
func (m *GormClusterRepository) CheckExists(ctx context.Context, id string) error
CheckExists returns nil if the given ID exists otherwise returns an error
func (*GormClusterRepository) Create ¶
func (m *GormClusterRepository) Create(ctx context.Context, c *Cluster) error
Create creates a new record.
func (*GormClusterRepository) CreateOrSave ¶
func (m *GormClusterRepository) CreateOrSave(ctx context.Context, c *Cluster) error
CreateOrSave creates cluster or saves cluster if any cluster found using url
func (*GormClusterRepository) Delete ¶
Delete removes a single record. This is a hard delete! Also, removes all identity/cluster relationship associated with this cluster.
func (*GormClusterRepository) Save ¶
func (m *GormClusterRepository) Save(ctx context.Context, c *Cluster) error
Save modifies a single record
func (*GormClusterRepository) TableName ¶
func (m *GormClusterRepository) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
type GormIdentityClusterRepository ¶
type GormIdentityClusterRepository struct {
// contains filtered or unexported fields
}
GormIdentityClusterRepository is the implementation of the storage interface for IdentityCluster.
func (*GormIdentityClusterRepository) Create ¶
func (m *GormIdentityClusterRepository) Create(ctx context.Context, c *IdentityCluster) error
Create creates a new record.
func (*GormIdentityClusterRepository) Delete ¶
func (m *GormIdentityClusterRepository) Delete(ctx context.Context, identityID uuid.UUID, clusterURL string) error
Delete removes the identity/cluster relationship identified by the given `identityID` and `clusterURL`
func (*GormIdentityClusterRepository) ListClustersForIdentity ¶
func (m *GormIdentityClusterRepository) ListClustersForIdentity(ctx context.Context, identityID uuid.UUID) ([]Cluster, error)
ListClustersForIdentity returns the list of all cluster for the identity
func (*GormIdentityClusterRepository) Load ¶
func (m *GormIdentityClusterRepository) Load(ctx context.Context, identityID, clusterID uuid.UUID) (*IdentityCluster, error)
Load returns a single Identity Cluster as a Database Model
func (*GormIdentityClusterRepository) TableName ¶
func (m *GormIdentityClusterRepository) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
type IdentityCluster ¶
type IdentityCluster struct { gormsupport.Lifecycle // The associated Identity ID IdentityID uuid.UUID `sql:"type:uuid" gorm:"primary_key;column:identity_id"` // The associated cluster Cluster Cluster `gorm:"ForeignKey:ClusterID;association_foreignkey:ClusterID"` // The foreign key value for ClusterID ClusterID uuid.UUID ` sql:"type:uuid" gorm:"primary_key;column:cluster_id"` }
IdentityCluster a type that associates an Identity to a Cluster
func (IdentityCluster) TableName ¶
func (m IdentityCluster) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
type IdentityClusterRepository ¶
type IdentityClusterRepository interface { Load(ctx context.Context, identityID, clusterID uuid.UUID) (*IdentityCluster, error) ListClustersForIdentity(ctx context.Context, identityID uuid.UUID) ([]Cluster, error) Create(ctx context.Context, u *IdentityCluster) error Delete(ctx context.Context, identityID uuid.UUID, clusterURL string) error }
IdentityClusterRepository represents the storage interface.
func NewIdentityClusterRepository ¶
func NewIdentityClusterRepository(db *gorm.DB) IdentityClusterRepository
NewIdentityClusterRepository creates a new storage type.