sqlinstance

package
v0.0.0-...-f8970bf Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewDatabaseWatcher

func NewDatabaseWatcher(ctx context.Context, mgr *watcher.Manager) *watcher.Watcher[*SQLDatabase]

func NewInstanceWatcher

func NewInstanceWatcher(ctx context.Context, mgr *watcher.Manager) *watcher.Watcher[*SQLInstance]

func NewLoaderContext

func NewLoaderContext(
	ctx context.Context,
	client *Client,
	sqlDatabaseWatcher *watcher.Watcher[*SQLDatabase],
	sqlInstanceWatcher *watcher.Watcher[*SQLInstance],
) context.Context
func Search(ctx context.Context, q string) ([]*search.Result, error)

Types

type Client

type Client struct {
	Admin *SQLAdminService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, log logrus.FieldLogger, opts ...ClientOption) (*Client, error)

type ClientOption

type ClientOption func(*Client)

func WithFakeClients

func WithFakeClients(enabled bool) ClientOption

func WithInstanceWatcher

func WithInstanceWatcher(w *watcher.Watcher[*SQLInstance]) ClientOption

type FakeGoogleAPI

type FakeGoogleAPI struct {
	ClientGRPCOptions []option.ClientOption
	ClientHTTPOptions []option.ClientOption

	monitoringpb.MetricServiceServer
	// contains filtered or unexported fields
}

func (FakeGoogleAPI) Close

func (f FakeGoogleAPI) Close()

type Metrics

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

func NewMetrics

func NewMetrics(ctx context.Context, log log.FieldLogger, opts ...option.ClientOption) (*Metrics, error)

func (*Metrics) Close

func (m *Metrics) Close() error

type MetricsOptions

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

type Option

type Option func(*MetricsOptions)

type RoundTripFunc

type RoundTripFunc func(req *http.Request) *http.Response

func (RoundTripFunc) RoundTrip

func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip .

type SQLAdminService

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

func NewSQLAdminService

func NewSQLAdminService(ctx context.Context, log logrus.FieldLogger, opts ...option.ClientOption) (*SQLAdminService, error)

func (*SQLAdminService) GetInstance

func (s *SQLAdminService) GetInstance(ctx context.Context, project string, instance string) (*sqladmin.DatabaseInstance, error)

func (*SQLAdminService) GetUsers

func (s *SQLAdminService) GetUsers(ctx context.Context, project string, instance string) ([]*sqladmin.User, error)

type SQLDatabase

type SQLDatabase struct {
	Name            string    `json:"name"`
	Charset         *string   `json:"charset,omitempty"`
	Collation       *string   `json:"collation,omitempty"`
	DeletionPolicy  *string   `json:"deletionPolicy,omitempty"`
	Healthy         bool      `json:"healthy"`
	SQLInstanceName string    `json:"-"`
	EnvironmentName string    `json:"-"`
	TeamSlug        slug.Slug `json:"-"`
}

func GetDatabase

func GetDatabase(ctx context.Context, teamSlug slug.Slug, environmentName, sqlInstanceName string) (*SQLDatabase, error)

func GetDatabaseByIdent

func GetDatabaseByIdent(ctx context.Context, id ident.Ident) (*SQLDatabase, error)

func (*SQLDatabase) DeepCopyObject

func (d *SQLDatabase) DeepCopyObject() runtime.Object

func (*SQLDatabase) GetLabels

func (d *SQLDatabase) GetLabels() map[string]string

func (*SQLDatabase) GetName

func (d *SQLDatabase) GetName() string

func (*SQLDatabase) GetNamespace

func (d *SQLDatabase) GetNamespace() string

func (*SQLDatabase) GetObjectKind

func (d *SQLDatabase) GetObjectKind() schema.ObjectKind

func (SQLDatabase) ID

func (d SQLDatabase) ID() ident.Ident

func (SQLDatabase) IsNode

func (SQLDatabase) IsNode()

func (SQLDatabase) IsPersistence

func (SQLDatabase) IsPersistence()

type SQLInstance

type SQLInstance struct {
	Name                string                          `json:"name"`
	CascadingDelete     bool                            `json:"cascadingDelete"`
	ConnectionName      *string                         `json:"connectionName,omitempty"`
	DiskAutoresize      *bool                           `json:"diskAutoresize,omitempty"`
	DiskAutoresizeLimit *int64                          `json:"diskAutoresizeLimit,omitempty"`
	HighAvailability    bool                            `json:"highAvailability"`
	Healthy             bool                            `json:"healthy"`
	MaintenanceVersion  *string                         `json:"maintenanceVersion,omitempty"`
	MaintenanceWindow   *SQLInstanceMaintenanceWindow   `json:"maintenanceWindow,omitempty"`
	BackupConfiguration *SQLInstanceBackupConfiguration `json:"backupConfiguration,omitempty"`
	ProjectID           string                          `json:"projectID"`
	Tier                string                          `json:"tier"`
	Version             *string                         `json:"version,omitempty"`
	Status              *SQLInstanceStatus              `json:"status"`
	Flags               []*SQLInstanceFlag              `json:"-"`
	EnvironmentName     string                          `json:"-"`
	TeamSlug            slug.Slug                       `json:"-"`
	WorkloadReference   *workload.Reference             `json:"-"`
}

func Get

func Get(ctx context.Context, teamSlug slug.Slug, environmentName, sqlInstanceName string) (*SQLInstance, error)

func GetByIdent

func GetByIdent(ctx context.Context, id ident.Ident) (*SQLInstance, error)

func ListAllForTeam

func ListAllForTeam(ctx context.Context, teamSlug slug.Slug) []*SQLInstance

func (*SQLInstance) DeepCopyObject

func (i *SQLInstance) DeepCopyObject() runtime.Object

func (*SQLInstance) GetLabels

func (i *SQLInstance) GetLabels() map[string]string

func (*SQLInstance) GetName

func (i *SQLInstance) GetName() string

func (*SQLInstance) GetNamespace

func (i *SQLInstance) GetNamespace() string

func (*SQLInstance) GetObjectKind

func (i *SQLInstance) GetObjectKind() schema.ObjectKind

func (SQLInstance) ID

func (i SQLInstance) ID() ident.Ident

func (SQLInstance) IsNode

func (SQLInstance) IsNode()

func (SQLInstance) IsPersistence

func (SQLInstance) IsPersistence()

func (SQLInstance) IsSearchNode

func (SQLInstance) IsSearchNode()

type SQLInstanceBackupConfiguration

type SQLInstanceBackupConfiguration struct {
	Enabled                     *bool   `json:"enabled,omitempty"`
	StartTime                   *string `json:"startTime,omitempty"`
	RetainedBackups             *int64  `json:"retainedBackups,omitempty"`
	PointInTimeRecovery         *bool   `json:"pointInTimeRecovery,omitempty"`
	TransactionLogRetentionDays *int64  `json:"transactionLogRetentionDays,omitempty"`
}

type SQLInstanceCPU

type SQLInstanceCPU struct {
	Cores       float64 `json:"cores"`
	Utilization float64 `json:"utilization"`
}

func CPUForInstance

func CPUForInstance(ctx context.Context, projectID, instance string) (*SQLInstanceCPU, error)

type SQLInstanceConnection

type SQLInstanceConnection = pagination.Connection[*SQLInstance]

func ListForTeam

func ListForTeam(ctx context.Context, teamSlug slug.Slug, page *pagination.Pagination, orderBy *SQLInstanceOrder) (*SQLInstanceConnection, error)

func ListForWorkload

func ListForWorkload(ctx context.Context, teamSlug slug.Slug, environmentName string, references []nais_io_v1.CloudSqlInstance, orderBy *SQLInstanceOrder) (*SQLInstanceConnection, error)

type SQLInstanceDisk

type SQLInstanceDisk struct {
	QuotaBytes  int     `json:"quotaBytes"`
	Utilization float64 `json:"utilization"`
}

func DiskForInstance

func DiskForInstance(ctx context.Context, projectID, instance string) (*SQLInstanceDisk, error)

type SQLInstanceEdge

type SQLInstanceEdge = pagination.Edge[*SQLInstance]

type SQLInstanceFlag

type SQLInstanceFlag struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type SQLInstanceFlagConnection

type SQLInstanceFlagConnection = pagination.Connection[*SQLInstanceFlag]

type SQLInstanceFlagEdge

type SQLInstanceFlagEdge = pagination.Edge[*SQLInstanceFlag]

type SQLInstanceMaintenanceWindow

type SQLInstanceMaintenanceWindow struct {
	Day  int64 `json:"day"`
	Hour int64 `json:"hour"`
}

type SQLInstanceMemory

type SQLInstanceMemory struct {
	QuotaBytes  int     `json:"quotaBytes"`
	Utilization float64 `json:"utilization"`
}

func MemoryForInstance

func MemoryForInstance(ctx context.Context, projectID, instance string) (*SQLInstanceMemory, error)

type SQLInstanceMetrics

type SQLInstanceMetrics struct {
	InstanceName string `json:"-"`
	ProjectID    string `json:"-"`
}

func MetricsFor

func MetricsFor(ctx context.Context, projectID, name string) (*SQLInstanceMetrics, error)

type SQLInstanceOrder

type SQLInstanceOrder struct {
	Field     SQLInstanceOrderField `json:"field"`
	Direction model.OrderDirection  `json:"direction"`
}

type SQLInstanceOrderField

type SQLInstanceOrderField string
const (
	SQLInstanceOrderFieldName        SQLInstanceOrderField = "NAME"
	SQLInstanceOrderFieldVersion     SQLInstanceOrderField = "VERSION"
	SQLInstanceOrderFieldEnvironment SQLInstanceOrderField = "ENVIRONMENT"
	SQLInstanceOrderFieldStatus      SQLInstanceOrderField = "STATUS"
	SQLInstanceOrderFieldCost        SQLInstanceOrderField = "COST"
	SQLInstanceOrderFieldCPU         SQLInstanceOrderField = "CPU_UTILIZATION"
	SQLInstanceOrderFieldMemory      SQLInstanceOrderField = "MEMORY_UTILIZATION"
	SQLInstanceOrderFieldDisk        SQLInstanceOrderField = "DISK_UTILIZATION"
)

func (SQLInstanceOrderField) IsValid

func (e SQLInstanceOrderField) IsValid() bool

func (SQLInstanceOrderField) MarshalGQL

func (e SQLInstanceOrderField) MarshalGQL(w io.Writer)

func (SQLInstanceOrderField) String

func (e SQLInstanceOrderField) String() string

func (*SQLInstanceOrderField) UnmarshalGQL

func (e *SQLInstanceOrderField) UnmarshalGQL(v interface{}) error

type SQLInstanceState

type SQLInstanceState string
const (
	SQLInstanceStateUnspecified   SQLInstanceState = "UNSPECIFIED"
	SQLInstanceStateRunnable      SQLInstanceState = "RUNNABLE"
	SQLInstanceStateSuspended     SQLInstanceState = "SUSPENDED"
	SQLInstanceStatePendingDelete SQLInstanceState = "PENDING_DELETE"
	SQLInstanceStatePendingCreate SQLInstanceState = "PENDING_CREATE"
	SQLInstanceStateMaintenance   SQLInstanceState = "MAINTENANCE"
	SQLInstanceStateFailed        SQLInstanceState = "FAILED"
)

func GetState

func GetState(ctx context.Context, project, instance string) (SQLInstanceState, error)

func (SQLInstanceState) String

func (e SQLInstanceState) String() string

type SQLInstanceStatus

type SQLInstanceStatus struct {
	PublicIPAddress  *string `json:"publicIpAddress,omitempty"`
	PrivateIPAddress *string `json:"privateIpAddress,omitempty"`
}

type SQLInstanceUser

type SQLInstanceUser struct {
	Name           string `json:"name"`
	Authentication string `json:"authentication"`
}

type SQLInstanceUserConnection

type SQLInstanceUserConnection = pagination.Connection[*SQLInstanceUser]

func ListSQLInstanceUsers

func ListSQLInstanceUsers(ctx context.Context, sqlInstance *SQLInstance, page *pagination.Pagination, orderBy *SQLInstanceUserOrder) (*SQLInstanceUserConnection, error)

type SQLInstanceUserEdge

type SQLInstanceUserEdge = pagination.Edge[*SQLInstanceUser]

type SQLInstanceUserOrder

type SQLInstanceUserOrder struct {
	Field     SQLInstanceUserOrderField `json:"field"`
	Direction model.OrderDirection      `json:"direction"`
}

type SQLInstanceUserOrderField

type SQLInstanceUserOrderField string
const (
	SQLInstanceUserOrderFieldName           SQLInstanceUserOrderField = "NAME"
	SQLInstanceUserOrderFieldAuthentication SQLInstanceUserOrderField = "AUTHENTICATION"
)

func (SQLInstanceUserOrderField) IsValid

func (e SQLInstanceUserOrderField) IsValid() bool

func (SQLInstanceUserOrderField) MarshalGQL

func (e SQLInstanceUserOrderField) MarshalGQL(w io.Writer)

func (SQLInstanceUserOrderField) String

func (e SQLInstanceUserOrderField) String() string

func (*SQLInstanceUserOrderField) UnmarshalGQL

func (e *SQLInstanceUserOrderField) UnmarshalGQL(v interface{}) error

type TeamInventoryCountSQLInstances

type TeamInventoryCountSQLInstances struct {
	Total int
}

type TeamServiceUtilizationSQLInstances

type TeamServiceUtilizationSQLInstances struct {
	TeamSlug   slug.Slug `json:"-"`
	ProjectIDs []string  `json:"-"`
}

type TeamServiceUtilizationSQLInstancesCPU

type TeamServiceUtilizationSQLInstancesCPU struct {
	Used        float64 `json:"used"`
	Requested   float64 `json:"requested"`
	Utilization float64 `json:"utilization"`
}

func TeamSummaryCPU

func TeamSummaryCPU(ctx context.Context, projectID string) (*TeamServiceUtilizationSQLInstancesCPU, error)

type TeamServiceUtilizationSQLInstancesDisk

type TeamServiceUtilizationSQLInstancesDisk struct {
	Used        int     `json:"used"`
	Requested   int     `json:"requested"`
	Utilization float64 `json:"utilization"`
}

func TeamSummaryDisk

func TeamSummaryDisk(ctx context.Context, projectID string) (*TeamServiceUtilizationSQLInstancesDisk, error)

type TeamServiceUtilizationSQLInstancesMemory

type TeamServiceUtilizationSQLInstancesMemory struct {
	Used        int     `json:"used"`
	Requested   int     `json:"requested"`
	Utilization float64 `json:"utilization"`
}

func TeamSummaryMemory

func TeamSummaryMemory(ctx context.Context, projectID string) (*TeamServiceUtilizationSQLInstancesMemory, error)

Jump to

Keyboard shortcuts

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