Documentation ¶
Index ¶
- Variables
- func ApplyQuota(requestedQuotaOrig *v1.ResourceQuota, defaultQuota *v1.ResourceQuota, ...) *v1.ResourceQuota
- func CountAvailable[T AvailabilityMarker](resources []T) int
- func CountOlder(duration time.Duration, accounts []Resource) (int, error)
- func CountToCleanup[T AvailabilityMarker](resources []T) int
- func CountUsed[T AvailabilityMarker](resources []T) int
- func DeletePlacementByServiceUuid(dbpool *pgxpool.Pool, awsProvider AwsAccountProvider, ...) error
- func FilterByReservation[T AvailabilityMarker](resources []T, reservation string) []T
- func Sort[T Sortable](accounts []T, by string) []T
- func Used[T AvailabilityMarker](resources []T) []T
- type Account
- type Annotations
- type AvailabilityMarker
- type AwsAccount
- func (a AwsAccount) CloseAccount() error
- func (a AwsAccount) GetLastStatus(dbpool *pgxpool.Pool) (*LifecycleResourceJob, error)
- func (a AwsAccount) GetReservation() string
- func (a AwsAccount) GetUpdatedAt() time.Time
- func (a AwsAccount) NameInt() int
- func (a *AwsAccount) Render(w http.ResponseWriter, r *http.Request) error
- func (a AwsAccount) Start(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) error
- func (a AwsAccount) Status(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) (Status, error)
- func (a AwsAccount) Stop(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) error
- type AwsAccountProvider
- type AwsAccountWithCreds
- type AwsAccounts
- type AwsIamKey
- type Deletable
- type Instance
- type LifecyclePlacementJob
- type LifecycleResourceJob
- type Model
- type OcpSandbox
- type OcpSandboxProvider
- func (a *OcpSandboxProvider) FetchAll() ([]OcpSandbox, error)
- func (a *OcpSandboxProvider) FetchAllByServiceUuid(serviceUuid string) ([]OcpSandbox, error)
- func (a *OcpSandboxProvider) FetchAllByServiceUuidWithCreds(serviceUuid string) ([]OcpSandboxWithCreds, error)
- func (p *OcpSandboxProvider) FetchById(id int) (OcpSandbox, error)
- func (p *OcpSandboxProvider) FetchByName(name string) (OcpSandbox, error)
- func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurationByAnnotations(annotations map[string]string) ([]OcpSharedClusterConfiguration, error)
- func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurationByName(name string) (OcpSharedClusterConfiguration, error)
- func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurations() (OcpSharedClusterConfigurations, error)
- func (a *OcpSandboxProvider) GetSchedulableClusters(cloud_selector map[string]string) (OcpSharedClusterConfigurations, error)
- func (a *OcpSandboxProvider) Release(service_uuid string) error
- func (a *OcpSandboxProvider) Request(serviceUuid string, cloud_selector map[string]string, ...) (OcpSandboxWithCreds, error)
- type OcpSandboxWithCreds
- func (account *OcpSandboxWithCreds) Delete() error
- func (a *OcpSandboxWithCreds) GetStatus() (string, error)
- func (a *OcpSandboxWithCreds) IncrementCleanupCount() error
- func (a *OcpSandboxWithCreds) MarkForCleanup() error
- func (a *OcpSandboxWithCreds) Reload() error
- func (a *OcpSandboxWithCreds) Render(w http.ResponseWriter, r *http.Request) error
- func (a *OcpSandboxWithCreds) Save() error
- func (a *OcpSandboxWithCreds) SetStatus(status string) error
- func (a *OcpSandboxWithCreds) Update() error
- type OcpSandboxes
- type OcpServiceAccount
- type OcpSharedClusterConfiguration
- func (p *OcpSharedClusterConfiguration) Bind(r *http.Request) error
- func (a *OcpSharedClusterConfiguration) CreateRestConfig() (*rest.Config, error)
- func (p *OcpSharedClusterConfiguration) Delete() error
- func (p *OcpSharedClusterConfiguration) Disable() error
- func (p *OcpSharedClusterConfiguration) Enable() error
- func (p *OcpSharedClusterConfiguration) GetAccountCount() (int, error)
- func (p *OcpSharedClusterConfiguration) Render(w http.ResponseWriter, r *http.Request) error
- func (p *OcpSharedClusterConfiguration) Save() error
- func (a *OcpSharedClusterConfiguration) TestConnection() error
- func (p *OcpSharedClusterConfiguration) Update() error
- type OcpSharedClusterConfigurations
- type Placement
- func (p *Placement) Create() error
- func (p *Placement) Delete(accountProvider AwsAccountProvider, ocpProvider OcpSandboxProvider)
- func (p *Placement) GetLastStatus() ([]*LifecycleResourceJob, error)
- func (p *Placement) LoadActiveResources(awsProvider AwsAccountProvider) error
- func (p *Placement) LoadActiveResourcesWithCreds(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider) error
- func (p *Placement) LoadResources(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider) error
- func (p *Placement) LoadResourcesWithCreds(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider) error
- func (p *Placement) MarkForCleanup() error
- func (p *Placement) Render(w http.ResponseWriter, r *http.Request) error
- func (p *Placement) SetStatus(status string) error
- type PlacementWithCreds
- type Placements
- type Reservation
- func (r *Reservation) Delete(dbpool *pgxpool.Pool) error
- func (r *Reservation) Initialize(dbpool *pgxpool.Pool, a AwsAccountProvider)
- func (r *Reservation) Remove(dbpool *pgxpool.Pool, a AwsAccountProvider)
- func (o *Reservation) Render(w http.ResponseWriter, r *http.Request) error
- func (r *Reservation) Save(dbpool *pgxpool.Pool) error
- func (r *Reservation) Update(dbpool *pgxpool.Pool, a AwsAccountProvider, req ReservationRequest)
- func (r *Reservation) UpdateStatus(dbpool *pgxpool.Pool, status string) error
- type ReservationRequest
- type Reservations
- type Resource
- type ResourceRequest
- type ResourceWithCreds
- type Sortable
- type Status
- type Token
- type TokenResponse
- type Tokens
Constants ¶
This section is empty.
Variables ¶
var ErrAccountNotFound = errors.New("account not found")
var ErrNoClaim = errors.New("no claim")
var ErrNoEnoughAccountsAvailable = errors.New("no enough accounts available")
var ErrNoSchedule error = errors.New("No OCP shared cluster configuration found")
var OcpErrNoEnoughAccountsAvailable = errors.New("no enough accounts available")
Functions ¶
func ApplyQuota ¶ added in v1.0.0
func ApplyQuota(requestedQuotaOrig *v1.ResourceQuota, defaultQuota *v1.ResourceQuota, strictDefaultSandboxQuota bool) *v1.ResourceQuota
func CountAvailable ¶
func CountAvailable[T AvailabilityMarker](resources []T) int
CountAvailable return the number of resources not in use
func CountOlder ¶
CountOlder returns the number of accounts in use for more than N day
func CountToCleanup ¶
func CountToCleanup[T AvailabilityMarker](resources []T) int
CountToCleanup return the number of accounts to cleanup
func CountUsed ¶
func CountUsed[T AvailabilityMarker](resources []T) int
CountUsed return the number of resources in use
func DeletePlacementByServiceUuid ¶
func DeletePlacementByServiceUuid(dbpool *pgxpool.Pool, awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider, serviceUuid string) error
DeletePlacementByServiceUuid deletes a placement by ServiceUuid
func FilterByReservation ¶ added in v0.3.5
func FilterByReservation[T AvailabilityMarker](resources []T, reservation string) []T
Types ¶
type Annotations ¶ added in v0.3.17
func (Annotations) Merge ¶ added in v0.3.17
func (a Annotations) Merge(b Annotations) Annotations
type AvailabilityMarker ¶
type AvailabilityMarker interface { GetReservation() string // contains filtered or unexported methods }
type AwsAccount ¶
type AwsAccount struct { Account Kind string `json:"kind"` // "AwsSandbox" Name string `json:"name"` Reservation string `json:"reservation,omitempty"` AccountID string `json:"account_id"` Zone string `json:"zone"` HostedZoneID string `json:"hosted_zone_id"` ConanStatus string `json:"conan_status,omitempty"` ConanTimestamp time.Time `json:"conan_timestamp,omitempty"` ConanHostname string `json:"conan_hostname,omitempty"` ConanCleanupCount int `json:"conan_cleanup_count,omitempty"` }
func (AwsAccount) CloseAccount ¶ added in v0.3.16
func (a AwsAccount) CloseAccount() error
func (AwsAccount) GetLastStatus ¶ added in v0.3.0
func (a AwsAccount) GetLastStatus(dbpool *pgxpool.Pool) (*LifecycleResourceJob, error)
func (AwsAccount) GetReservation ¶ added in v0.3.5
func (a AwsAccount) GetReservation() string
func (AwsAccount) GetUpdatedAt ¶
func (a AwsAccount) GetUpdatedAt() time.Time
func (AwsAccount) NameInt ¶
func (a AwsAccount) NameInt() int
func (*AwsAccount) Render ¶ added in v0.3.5
func (a *AwsAccount) Render(w http.ResponseWriter, r *http.Request) error
func (AwsAccount) Start ¶ added in v0.3.0
func (a AwsAccount) Start(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) error
Start method starts all the stopped instances in the account
func (AwsAccount) Status ¶ added in v0.3.0
func (a AwsAccount) Status(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) (Status, error)
Status method returns the status of all the instances in the account
func (AwsAccount) Stop ¶ added in v0.3.0
func (a AwsAccount) Stop(ctx context.Context, creds *ststypes.Credentials, job *LifecycleResourceJob) error
Stop method stops all the running instances in the account
type AwsAccountProvider ¶
type AwsAccountProvider interface { //Annotations(account AwsAccount) (map[string]string, error) Count() (int, error) CountAvailable(reservation string) (int, error) DecryptSecret(encrypted string) (string, error) Delete(name string) error FetchAll() ([]AwsAccount, error) FetchAllActiveByServiceUuid(serviceUuid string) ([]AwsAccount, error) FetchAllActiveByServiceUuidWithCreds(serviceUuid string) ([]AwsAccountWithCreds, error) FetchAllAvailable() ([]AwsAccount, error) FetchAllByReservation(reservation string) ([]AwsAccount, error) FetchAllByServiceUuid(serviceUuid string) ([]AwsAccount, error) FetchAllByServiceUuidWithCreds(serviceUuid string) ([]AwsAccountWithCreds, error) FetchAllSorted(by string) ([]AwsAccount, error) FetchAllToCleanup() ([]AwsAccount, error) FetchByName(name string) (AwsAccount, error) MarkForCleanup(name string) error MarkForCleanupByServiceUuid(serviceUuid string) error Request(service_uuid string, reservation string, count int, annotations Annotations) ([]AwsAccountWithCreds, error) Reserve(reservation string, count int) ([]AwsAccount, error) ScaleDownReservation(reservation string, count int) error }
AwsAccountProvider interface to interact with different databases: dynamodb and postgresql
type AwsAccountWithCreds ¶
type AwsAccountWithCreds struct { AwsAccount Credentials []any `json:"credentials"` Provider AwsAccountProvider `json:"-"` }
func (*AwsAccountWithCreds) Delete ¶ added in v0.3.17
func (a *AwsAccountWithCreds) Delete() error
func (*AwsAccountWithCreds) Render ¶ added in v0.3.17
func (a *AwsAccountWithCreds) Render(w http.ResponseWriter, r *http.Request) error
type AwsAccounts ¶ added in v0.3.5
type AwsAccounts []AwsAccount
func (*AwsAccounts) Render ¶ added in v0.3.5
func (a *AwsAccounts) Render(w http.ResponseWriter, r *http.Request) error
type LifecyclePlacementJob ¶ added in v0.3.0
type LifecyclePlacementJob struct { Model PlacementID int `json:"placement_id"` Status string `json:"status"` Action string `json:"lifecycle_action"` Request any `json:"request,omitempty"` RequestID string `json:"request_id,omitempty"` DbPool *pgxpool.Pool `json:"-"` Locality string `json:"locality,omitempty"` }
func GetLifecyclePlacementJob ¶ added in v0.3.0
func GetLifecyclePlacementJob(dbpool *pgxpool.Pool, id int) (*LifecyclePlacementJob, error)
GetLifecyclePlacementJob returns a LifecyclePlacementJob by ID
func GetLifecyclePlacementJobByRequestID ¶ added in v0.3.3
func GetLifecyclePlacementJobByRequestID(dbpool *pgxpool.Pool, requestID string) (*LifecyclePlacementJob, error)
GetLifecyclePlacementJob returns a LifecyclePlacementJob by ID
func (*LifecyclePlacementJob) Claim ¶ added in v0.3.0
func (j *LifecyclePlacementJob) Claim() error
ClaimPlacementJob claims a placement job by setting the status to initializing
func (*LifecyclePlacementJob) Create ¶ added in v0.3.3
func (j *LifecyclePlacementJob) Create() error
Create creates a new LifecyclePlacementJob by inserting it into the database
func (*LifecyclePlacementJob) GlobalStatus ¶ added in v0.3.3
func (j *LifecyclePlacementJob) GlobalStatus() (string, error)
GlobalStatus returns the status of a LifecyclePlacementJob considering all it's children
func (*LifecyclePlacementJob) SetStatus ¶ added in v0.3.0
func (j *LifecyclePlacementJob) SetStatus(status string) error
SetLifecycleResourceJobStatus sets the status of a LifecycleResourceJob
type LifecycleResourceJob ¶ added in v0.3.0
type LifecycleResourceJob struct { Model ResourceName string `json:"resource_name"` ResourceType string `json:"resource_type"` ParentID int `json:"parent_id,omitempty"` Status string `json:"status"` Action string `json:"lifecycle_action"` Request any `json:"request,omitempty"` RequestID string `json:"request_id,omitempty"` DbPool *pgxpool.Pool `json:"-"` Result Status `json:"lifecycle_result,omitempty"` Locality string `json:"locality,omitempty"` }
func GetLifecycleResourceJob ¶ added in v0.3.0
func GetLifecycleResourceJob(dbpool *pgxpool.Pool, id int) (*LifecycleResourceJob, error)
GetLifecycleResourceJob returns a LifecycleResourceJob by ID
func GetLifecycleResourceJobByRequestID ¶ added in v0.3.3
func GetLifecycleResourceJobByRequestID(dbpool *pgxpool.Pool, requestID string) (*LifecycleResourceJob, error)
func (*LifecycleResourceJob) Claim ¶ added in v0.3.0
func (j *LifecycleResourceJob) Claim() error
ClaimResourceJob claims a resource job by setting the status to initializing
func (*LifecycleResourceJob) Create ¶ added in v0.3.0
func (j *LifecycleResourceJob) Create() error
Create creates a new LifecycleResourceJob by inserting it into the database
func (*LifecycleResourceJob) SetStatus ¶ added in v0.3.0
func (j *LifecycleResourceJob) SetStatus(status string) error
SetLifecycleResourceJobStatus sets the status of a LifecycleResourceJob
type OcpSandbox ¶ added in v0.3.17
type OcpSandbox struct { Account Name string `json:"name"` Kind string `json:"kind"` // "OcpSandbox" ServiceUuid string `json:"service_uuid"` OcpIngressDomain string `json:"ingress_domain"` OcpApiUrl string `json:"api_url"` Annotations map[string]string `json:"annotations"` Status string `json:"status"` ErrorMessage string `json:"error_message,omitempty"` CleanupCount int `json:"cleanup_count"` Namespace string `json:"namespace"` ClusterAdditionalVars map[string]any `json:"cluster_additional_vars,omitempty"` ToCleanup bool `json:"to_cleanup"` Quota v1.ResourceList `json:"quota,omitempty"` LimitRange *v1.LimitRange `json:"limit_range,omitempty"` }
func (*OcpSandbox) Render ¶ added in v0.3.17
func (a *OcpSandbox) Render(w http.ResponseWriter, r *http.Request) error
type OcpSandboxProvider ¶ added in v0.3.17
func NewOcpSandboxProvider ¶ added in v0.3.17
func NewOcpSandboxProvider(dbpool *pgxpool.Pool, vaultSecret string) OcpSandboxProvider
func (*OcpSandboxProvider) FetchAll ¶ added in v0.3.17
func (a *OcpSandboxProvider) FetchAll() ([]OcpSandbox, error)
func (*OcpSandboxProvider) FetchAllByServiceUuid ¶ added in v0.3.17
func (a *OcpSandboxProvider) FetchAllByServiceUuid(serviceUuid string) ([]OcpSandbox, error)
func (*OcpSandboxProvider) FetchAllByServiceUuidWithCreds ¶ added in v0.3.17
func (a *OcpSandboxProvider) FetchAllByServiceUuidWithCreds(serviceUuid string) ([]OcpSandboxWithCreds, error)
func (*OcpSandboxProvider) FetchById ¶ added in v0.3.17
func (p *OcpSandboxProvider) FetchById(id int) (OcpSandbox, error)
func (*OcpSandboxProvider) FetchByName ¶ added in v0.3.17
func (p *OcpSandboxProvider) FetchByName(name string) (OcpSandbox, error)
func (*OcpSandboxProvider) GetOcpSharedClusterConfigurationByAnnotations ¶ added in v0.3.17
func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurationByAnnotations(annotations map[string]string) ([]OcpSharedClusterConfiguration, error)
GetOcpSharedClusterConfigurationByAnnotations returns a list of OcpSharedClusterConfiguration by annotations
func (*OcpSandboxProvider) GetOcpSharedClusterConfigurationByName ¶ added in v0.3.17
func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurationByName(name string) (OcpSharedClusterConfiguration, error)
GetOcpSharedClusterConfigurationByName returns an OcpSharedClusterConfiguration by name
func (*OcpSandboxProvider) GetOcpSharedClusterConfigurations ¶ added in v0.3.17
func (p *OcpSandboxProvider) GetOcpSharedClusterConfigurations() (OcpSharedClusterConfigurations, error)
GetOcpSharedClusterConfigurations returns the full list of OcpSharedClusterConfiguration
func (*OcpSandboxProvider) GetSchedulableClusters ¶ added in v0.3.17
func (a *OcpSandboxProvider) GetSchedulableClusters(cloud_selector map[string]string) (OcpSharedClusterConfigurations, error)
func (*OcpSandboxProvider) Release ¶ added in v0.3.17
func (a *OcpSandboxProvider) Release(service_uuid string) error
func (*OcpSandboxProvider) Request ¶ added in v0.3.17
func (a *OcpSandboxProvider) Request(serviceUuid string, cloud_selector map[string]string, annotations map[string]string, requestedQuota *v1.ResourceList, requestedLimitRange *v1.LimitRange, multiple bool, ctx context.Context) (OcpSandboxWithCreds, error)
type OcpSandboxWithCreds ¶ added in v0.3.17
type OcpSandboxWithCreds struct { OcpSandbox Credentials []any `json:"credentials,omitempty"` Provider *OcpSandboxProvider `json:"-"` }
func (*OcpSandboxWithCreds) Delete ¶ added in v0.3.17
func (account *OcpSandboxWithCreds) Delete() error
func (*OcpSandboxWithCreds) GetStatus ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) GetStatus() (string, error)
func (*OcpSandboxWithCreds) IncrementCleanupCount ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) IncrementCleanupCount() error
func (*OcpSandboxWithCreds) MarkForCleanup ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) MarkForCleanup() error
func (*OcpSandboxWithCreds) Reload ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) Reload() error
func (*OcpSandboxWithCreds) Render ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) Render(w http.ResponseWriter, r *http.Request) error
func (*OcpSandboxWithCreds) Save ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) Save() error
func (*OcpSandboxWithCreds) SetStatus ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) SetStatus(status string) error
func (*OcpSandboxWithCreds) Update ¶ added in v0.3.17
func (a *OcpSandboxWithCreds) Update() error
type OcpSandboxes ¶ added in v0.3.17
type OcpSandboxes []OcpSandbox
type OcpServiceAccount ¶ added in v0.3.17
type OcpServiceAccount struct { Kind string `json:"kind"` // "ServiceAccount" Name string `json:"name"` Token string `json:"token"` }
Credential for service account
type OcpSharedClusterConfiguration ¶ added in v0.3.17
type OcpSharedClusterConfiguration struct { // for an OcpSandbox, a default ResourceQuota will be set. // This quota is designed to be large enough to accommodate general needs. // Additionally, content developers can specify custom quotas in agnosticV // based on the requirements of specific Labs/Demos. DefaultSandboxQuota *v1.ResourceQuota `json:"default_sandbox_quota"` // should be strictly enforced. If set to true, the default sandbox quota will be // enforced as a hard limit. Requested quota not be allowed to exceed the default. // If set to false, the default sandbox will be updated // to the requested quota. StrictDefaultSandboxQuota bool `json:"strict_default_sandbox_quota"` // for an OcpSandbox. // If set to true, a quota must be provided in the request. // If set to false, a quota will be created based on the default sandbox quota. // By default it's false. QuotaRequired bool `json:"quota_required"` // if set to true, the sandbox quota will not be created // if set to false, the sandbox quota will be created, depending on the value of QuotaRequired, DefaultSandboxQuota and StrictDefaultSandboxQuota // By default it's true. // TODO: change the default value to false SkipQuota bool `json:"skip_quota"` // This allows to set the default limit and request for pods // see https://kubernetes.io/docs/concepts/policy/limit-range/ LimitRange *v1.LimitRange `json:"limit_range,omitempty"` }
func MakeOcpSharedClusterConfiguration ¶ added in v1.0.0
func MakeOcpSharedClusterConfiguration() *OcpSharedClusterConfiguration
MakeOcpSharedClusterConfiguration creates a new OcpSharedClusterConfiguration with default values
func (*OcpSharedClusterConfiguration) Bind ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Bind(r *http.Request) error
Bind and Render
func (*OcpSharedClusterConfiguration) CreateRestConfig ¶ added in v0.3.20
func (a *OcpSharedClusterConfiguration) CreateRestConfig() (*rest.Config, error)
func (*OcpSharedClusterConfiguration) Delete ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Delete() error
func (*OcpSharedClusterConfiguration) Disable ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Disable() error
Disable an OcpSharedClusterConfiguration
func (*OcpSharedClusterConfiguration) Enable ¶ added in v0.3.26
func (p *OcpSharedClusterConfiguration) Enable() error
Enable an OcpSharedClusterConfiguration
func (*OcpSharedClusterConfiguration) GetAccountCount ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) GetAccountCount() (int, error)
CountAccounts returns the number of accounts for an OcpSharedClusterConfiguration
func (*OcpSharedClusterConfiguration) Render ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Render(w http.ResponseWriter, r *http.Request) error
func (*OcpSharedClusterConfiguration) Save ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Save() error
func (*OcpSharedClusterConfiguration) TestConnection ¶ added in v1.0.1
func (a *OcpSharedClusterConfiguration) TestConnection() error
func (*OcpSharedClusterConfiguration) Update ¶ added in v0.3.17
func (p *OcpSharedClusterConfiguration) Update() error
type OcpSharedClusterConfigurations ¶ added in v0.3.17
type OcpSharedClusterConfigurations []OcpSharedClusterConfiguration
func (*OcpSharedClusterConfigurations) Render ¶ added in v0.3.17
func (p *OcpSharedClusterConfigurations) Render(w http.ResponseWriter, r *http.Request) error
Bind and Render for OcpSharedClusterConfigurations
type Placement ¶
type Placement struct { Model ServiceUuid string `json:"service_uuid"` Status string `json:"status"` ToCleanup bool `json:"to_cleanup"` Annotations map[string]string `json:"annotations"` Resources []any `json:"resources,omitempty"` Request any `json:"request"` DbPool *pgxpool.Pool `json:"-"` FailOnDelete bool `json:"-"` // plumbing for testing }
func GetPlacement ¶
GetPlacement returns a placement by ID
func GetPlacementByServiceUuid ¶
GetPlacementByServiceUuid returns a placement by service_uuid
func (*Placement) Delete ¶
func (p *Placement) Delete(accountProvider AwsAccountProvider, ocpProvider OcpSandboxProvider)
Delete deletes a placement
func (*Placement) GetLastStatus ¶ added in v0.3.3
func (p *Placement) GetLastStatus() ([]*LifecycleResourceJob, error)
func (*Placement) LoadActiveResources ¶ added in v0.3.5
func (p *Placement) LoadActiveResources(awsProvider AwsAccountProvider) error
func (*Placement) LoadActiveResourcesWithCreds ¶ added in v0.3.5
func (p *Placement) LoadActiveResourcesWithCreds(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider) error
func (*Placement) LoadResources ¶
func (p *Placement) LoadResources(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider) error
func (*Placement) LoadResourcesWithCreds ¶ added in v0.3.1
func (p *Placement) LoadResourcesWithCreds(awsProvider AwsAccountProvider, ocpProvider OcpSandboxProvider) error
func (*Placement) MarkForCleanup ¶ added in v0.3.19
type PlacementWithCreds ¶
type Placements ¶
type Placements []Placement
func GetAllPlacements ¶
func GetAllPlacements(dbpool *pgxpool.Pool) (Placements, error)
func (Placements) Render ¶
func (p Placements) Render(w http.ResponseWriter, r *http.Request) error
type Reservation ¶ added in v0.3.5
type Reservation struct { Model Name string `json:"name"` Status string `json:"status"` Request ReservationRequest `json:"request"` }
func GetReservationByName ¶ added in v0.3.5
func GetReservationByName(dbpool *pgxpool.Pool, name string) (Reservation, error)
GetReservationByName fetches a reservation by its name returns the reservation and an error
func (*Reservation) Delete ¶ added in v0.3.5
func (r *Reservation) Delete(dbpool *pgxpool.Pool) error
Delete deletes a reservation from the DB
func (*Reservation) Initialize ¶ added in v0.3.5
func (r *Reservation) Initialize(dbpool *pgxpool.Pool, a AwsAccountProvider)
Initialize initializes a reservation It's an async operation that takes care of keeping the resources reserved Status up to date and also update the resources to match what's defined in Request. When everything is in sync, Status is set to 'success' If something goes wrong, Status is set to 'error'
func (*Reservation) Remove ¶ added in v0.3.5
func (r *Reservation) Remove(dbpool *pgxpool.Pool, a AwsAccountProvider)
Delete deletes a reservation This is an async operation that goes through all the reserved resources and unmark them. Then the reservation is deleted from the DB is all goes well. If something goes wrong, the reservation is marked as 'error'
func (*Reservation) Render ¶ added in v0.3.5
func (o *Reservation) Render(w http.ResponseWriter, r *http.Request) error
func (*Reservation) Save ¶ added in v0.3.5
func (r *Reservation) Save(dbpool *pgxpool.Pool) error
Save saves a reservation to the database Reservations implies async operations. This function is low level and doesn't deal with async operations. For that, see the Initialize and Synchronize methods
func (*Reservation) Update ¶ added in v0.3.5
func (r *Reservation) Update(dbpool *pgxpool.Pool, a AwsAccountProvider, req ReservationRequest)
Update is an async operation to update a reservation from a reservationRequest
func (*Reservation) UpdateStatus ¶ added in v0.3.5
func (r *Reservation) UpdateStatus(dbpool *pgxpool.Pool, status string) error
UpdateStatus updates the status of a reservation
type ReservationRequest ¶ added in v0.3.5
type ReservationRequest struct { Name string `json:"name"` Resources []ResourceRequest `json:"resources"` }
func (*ReservationRequest) Bind ¶ added in v0.3.5
func (r *ReservationRequest) Bind(r2 *http.Request) error
func (*ReservationRequest) Validate ¶ added in v0.3.5
func (r *ReservationRequest) Validate(h AwsAccountProvider) (string, error)
type Reservations ¶ added in v0.3.5
type Reservations []Reservation
func (Reservations) Render ¶ added in v0.3.5
func (o Reservations) Render(w http.ResponseWriter, r *http.Request) error
type ResourceRequest ¶ added in v0.3.5
type ResourceWithCreds ¶
type Status ¶ added in v0.3.0
type Status struct { AccountName string `json:"account_name"` AccountKind string `json:"account_kind"` Instances []Instance `json:"instances"` UpdatedAt time.Time `json:"updated_at,omitempty"` Status string `json:"status,omitempty"` }
Status type
func MakeStatus ¶ added in v0.3.3
func MakeStatus(job *LifecycleResourceJob) Status
type Token ¶
type Token struct { Model Kind string `json:"kind"` Name string `json:"name"` Role string `json:"role"` Iat int64 `json:"iat"` Exp int64 `json:"exp"` Expiration time.Time `json:"expiration"` Valid bool `json:"valid"` }
func (Token) Invalidate ¶
Invalidate the token
type TokenResponse ¶ added in v0.3.17
type TokenResponse struct {
AccessToken string `json:"access_token"`
}