database

package
v2.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyRequest

type ApplyRequest struct {
	Zone string `request:"-" validate:"required"`

	ID                    types.ID `request:"-"`
	Name                  string   `validate:"required"`
	Description           string   `validate:"min=0,max=512"`
	Tags                  types.Tags
	IconID                types.ID
	PlanID                types.ID `validate:"required"`
	SwitchID              types.ID `validate:"required"`
	IPAddresses           []string `validate:"required,min=1,max=2,dive,ipv4"`
	NetworkMaskLen        int      `validate:"required,min=1,max=32"`
	DefaultRoute          string   `validate:"omitempty,ipv4"`
	Port                  int      `validate:"omitempty,min=1,max=65535"`
	SourceNetwork         []string `validate:"dive,cidrv4"`
	DatabaseType          string   `validate:"required,oneof=mariadb postgres"`
	Username              string   `validate:"required"`
	Password              string   `validate:"required"`
	EnableReplication     bool
	ReplicaUserPassword   string `validate:"required_with=EnableReplication"`
	EnableWebUI           bool
	EnableBackup          bool
	BackupWeekdays        []types.EBackupSpanWeekday `validate:"required_with=EnableBackup,max=7"`
	BackupStartTimeHour   int                        `validate:"omitempty,min=0,max=23"`
	BackupStartTimeMinute int                        `validate:"omitempty,oneof=0 15 30 45"`
	Parameters            map[string]interface{}

	NoWait bool
}

func (*ApplyRequest) Builder

func (req *ApplyRequest) Builder(caller sacloud.APICaller) (*Builder, error)

func (*ApplyRequest) Validate

func (req *ApplyRequest) Validate() error

type BootRequest

type BootRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`

	NoWait bool `request:"-"`
}

func (*BootRequest) Validate

func (req *BootRequest) Validate() error

type Builder

type Builder struct {
	ID   types.ID `request:"-"`
	Zone string   `request:"-"`

	Name                  string `validate:"required"`
	Description           string `validate:"min=0,max=512"`
	Tags                  types.Tags
	IconID                types.ID
	PlanID                types.ID `validate:"required"`
	SwitchID              types.ID `validate:"required"`
	IPAddresses           []string `validate:"required,min=1,max=2,dive,ipv4"`
	NetworkMaskLen        int      `validate:"required,min=1,max=32"`
	DefaultRoute          string   `validate:"omitempty,ipv4"`
	Port                  int      `validate:"omitempty,min=1,max=65535"`
	SourceNetwork         []string `validate:"omitempty,dive,cidrv4"`
	DatabaseType          string   `validate:"required,oneof=mariadb postgres"`
	Username              string   `validate:"required"`
	Password              string   `validate:"required"`
	EnableReplication     bool
	ReplicaUserPassword   string `validate:"required_with=EnableReplication"`
	EnableWebUI           bool
	EnableBackup          bool
	BackupWeekdays        []types.EBackupSpanWeekday `validate:"required_with=EnableBackup,max=7"`
	BackupStartTimeHour   int                        `validate:"omitempty,min=0,max=23"`
	BackupStartTimeMinute int                        `validate:"omitempty,oneof=0 15 30 45"`
	Parameters            map[string]interface{}

	NoWait bool

	Caller sacloud.APICaller `request:"-"`
}

Builder helper/builder/databaseの移行までの暫定実装

移行するまではhelper/builder/databaseを呼び出す処理のみ行う

func BuilderFromResource

func BuilderFromResource(ctx context.Context, caller sacloud.APICaller, zone string, id types.ID) (*Builder, error)

func (*Builder) Build

func (b *Builder) Build(ctx context.Context) (*sacloud.Database, error)

type CreateRequest

type CreateRequest struct {
	Zone string `request:"-" validate:"required"`

	Name                  string `validate:"required"`
	Description           string `validate:"min=0,max=512"`
	Tags                  types.Tags
	IconID                types.ID
	PlanID                types.ID `validate:"required"`
	SwitchID              types.ID `validate:"required"`
	IPAddresses           []string `validate:"required,min=1,max=2,dive,ipv4"`
	NetworkMaskLen        int      `validate:"required,min=1,max=32"`
	DefaultRoute          string   `validate:"omitempty,ipv4"`
	Port                  int      `validate:"omitempty,min=1,max=65535"`
	SourceNetwork         []string `validate:"omitempty,dive,cidrv4"`
	DatabaseType          string   `validate:"required,oneof=mariadb postgres"`
	Username              string   `validate:"required"`
	Password              string   `validate:"required"`
	EnableReplication     bool
	ReplicaUserPassword   string `validate:"required_with=EnableReplication"`
	EnableWebUI           bool
	EnableBackup          bool
	BackupWeekdays        []types.EBackupSpanWeekday `validate:"required_with=EnableBackup,max=7"`
	BackupStartTimeHour   int                        `validate:"omitempty,min=0,max=23"`
	BackupStartTimeMinute int                        `validate:"omitempty,oneof=0 15 30 45"`
	Parameters            map[string]interface{}

	NoWait bool
}

func (*CreateRequest) ApplyRequest added in v2.9.0

func (req *CreateRequest) ApplyRequest() *ApplyRequest

func (*CreateRequest) Validate

func (req *CreateRequest) Validate() error

type DeleteRequest

type DeleteRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`

	FailIfNotFound bool `request:"-"`
	Force          bool `request:"-"` // trueの場合は電源OFF(強制終了)してから削除
}

func (*DeleteRequest) Validate

func (req *DeleteRequest) Validate() error

type FindRequest

type FindRequest struct {
	Zone string `request:"-" validate:"required"`

	Names []string `request:"-"`
	Tags  []string `request:"-"`

	Sort  search.SortKeys
	Count int
	From  int
}

func (*FindRequest) ToRequestParameter

func (req *FindRequest) ToRequestParameter() (*sacloud.FindCondition, error)

func (*FindRequest) Validate

func (req *FindRequest) Validate() error

type ListParameterRequest added in v2.11.0

type ListParameterRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`
}

func (*ListParameterRequest) Validate added in v2.11.0

func (req *ListParameterRequest) Validate() error

type MonitorCPURequest

type MonitorCPURequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`

	Start time.Time
	End   time.Time
}

func (*MonitorCPURequest) Validate

func (req *MonitorCPURequest) Validate() error

type MonitorDatabaseRequest

type MonitorDatabaseRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`

	Start time.Time
	End   time.Time
}

func (*MonitorDatabaseRequest) Validate

func (req *MonitorDatabaseRequest) Validate() error

type MonitorDiskRequest

type MonitorDiskRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`

	Start time.Time
	End   time.Time
}

func (*MonitorDiskRequest) Validate

func (req *MonitorDiskRequest) Validate() error

type MonitorInterfaceRequest

type MonitorInterfaceRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`

	Start time.Time
	End   time.Time
}

func (*MonitorInterfaceRequest) Validate

func (req *MonitorInterfaceRequest) Validate() error

type Parameter added in v2.11.0

type Parameter struct {
	Key   string
	Value interface{}
	Meta  *sacloud.DatabaseParameterMeta
}

type ReadRequest

type ReadRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`
}

func (*ReadRequest) Validate

func (req *ReadRequest) Validate() error

type ResetRequest

type ResetRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`
}

func (*ResetRequest) Validate

func (req *ResetRequest) Validate() error

type Service

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

Service provides a high-level API of for Database

func New

func New(caller sacloud.APICaller) *Service

New returns new service instance of Database

func (*Service) Apply

func (s *Service) Apply(req *ApplyRequest) (*sacloud.Database, error)

func (*Service) ApplyWithContext

func (s *Service) ApplyWithContext(ctx context.Context, req *ApplyRequest) (*sacloud.Database, error)

func (*Service) Boot

func (s *Service) Boot(req *BootRequest) error

func (*Service) BootWithContext

func (s *Service) BootWithContext(ctx context.Context, req *BootRequest) error

func (*Service) Create

func (s *Service) Create(req *CreateRequest) (*sacloud.Database, error)

func (*Service) CreateWithContext

func (s *Service) CreateWithContext(ctx context.Context, req *CreateRequest) (*sacloud.Database, error)

func (*Service) Delete

func (s *Service) Delete(req *DeleteRequest) error

func (*Service) DeleteWithContext

func (s *Service) DeleteWithContext(ctx context.Context, req *DeleteRequest) error

func (*Service) Find

func (s *Service) Find(req *FindRequest) ([]*sacloud.Database, error)

func (*Service) FindWithContext

func (s *Service) FindWithContext(ctx context.Context, req *FindRequest) ([]*sacloud.Database, error)

func (*Service) ListParameter added in v2.11.0

func (s *Service) ListParameter(req *ListParameterRequest) ([]*Parameter, error)

func (*Service) ListParameterWithContext added in v2.11.0

func (s *Service) ListParameterWithContext(ctx context.Context, req *ListParameterRequest) ([]*Parameter, error)

func (*Service) MonitorCPU

func (s *Service) MonitorCPU(req *MonitorCPURequest) ([]*sacloud.MonitorCPUTimeValue, error)

func (*Service) MonitorCPUWithContext

func (s *Service) MonitorCPUWithContext(ctx context.Context, req *MonitorCPURequest) ([]*sacloud.MonitorCPUTimeValue, error)

func (*Service) MonitorDatabase

func (s *Service) MonitorDatabase(req *MonitorDatabaseRequest) ([]*sacloud.MonitorDatabaseValue, error)

func (*Service) MonitorDatabaseWithContext

func (s *Service) MonitorDatabaseWithContext(ctx context.Context, req *MonitorDatabaseRequest) ([]*sacloud.MonitorDatabaseValue, error)

func (*Service) MonitorDisk

func (s *Service) MonitorDisk(req *MonitorDiskRequest) ([]*sacloud.MonitorDiskValue, error)

func (*Service) MonitorDiskWithContext

func (s *Service) MonitorDiskWithContext(ctx context.Context, req *MonitorDiskRequest) ([]*sacloud.MonitorDiskValue, error)

func (*Service) MonitorInterface

func (s *Service) MonitorInterface(req *MonitorInterfaceRequest) ([]*sacloud.MonitorInterfaceValue, error)

func (*Service) MonitorInterfaceWithContext

func (s *Service) MonitorInterfaceWithContext(ctx context.Context, req *MonitorInterfaceRequest) ([]*sacloud.MonitorInterfaceValue, error)

func (*Service) Read

func (s *Service) Read(req *ReadRequest) (*sacloud.Database, error)

func (*Service) ReadWithContext

func (s *Service) ReadWithContext(ctx context.Context, req *ReadRequest) (*sacloud.Database, error)

func (*Service) Reset

func (s *Service) Reset(req *ResetRequest) error

func (*Service) ResetWithContext

func (s *Service) ResetWithContext(ctx context.Context, req *ResetRequest) error

func (*Service) Shutdown

func (s *Service) Shutdown(req *ShutdownRequest) error

func (*Service) ShutdownWithContext

func (s *Service) ShutdownWithContext(ctx context.Context, req *ShutdownRequest) error

func (*Service) Update

func (s *Service) Update(req *UpdateRequest) (*sacloud.Database, error)

func (*Service) UpdateWithContext

func (s *Service) UpdateWithContext(ctx context.Context, req *UpdateRequest) (*sacloud.Database, error)

func (*Service) WaitBoot

func (s *Service) WaitBoot(req *WaitBootRequest) error

func (*Service) WaitBootWithContext

func (s *Service) WaitBootWithContext(ctx context.Context, req *WaitBootRequest) error

func (*Service) WaitShutdown

func (s *Service) WaitShutdown(req *WaitShutdownRequest) error

func (*Service) WaitShutdownWithContext

func (s *Service) WaitShutdownWithContext(ctx context.Context, req *WaitShutdownRequest) error

type ShutdownRequest

type ShutdownRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`

	NoWait        bool `request:"-"`
	ForceShutdown bool `request:"-"`
}

func (*ShutdownRequest) Validate

func (req *ShutdownRequest) Validate() error

type UpdateRequest

type UpdateRequest struct {
	Zone string   `validate:"required"`
	ID   types.ID `validate:"required"`

	Name        *string     `request:",omitempty" validate:"omitempty,min=1"`
	Description *string     `request:",omitempty" validate:"omitempty,min=1,max=512"`
	Tags        *types.Tags `request:",omitempty"`
	IconID      *types.ID   `request:",omitempty"`

	SourceNetwork         *[]string                   `request:",omitempty" validate:"omitempty,dive,cidrv4"`
	EnableReplication     *bool                       `request:",omitempty"`
	ReplicaUserPassword   *string                     `request:",omitempty" validate:"omitempty,required_with=EnableReplication"`
	EnableWebUI           *bool                       `request:",omitempty"`
	EnableBackup          *bool                       `request:",omitempty"`
	BackupWeekdays        *[]types.EBackupSpanWeekday `request:",omitempty" validate:"omitempty,required_with=EnableBackup,max=7"`
	BackupStartTimeHour   *int                        `request:",omitempty" validate:"omitempty,min=0,max=23"`
	BackupStartTimeMinute *int                        `request:",omitempty" validate:"omitempty,oneof=0 15 30 45"`
	Parameters            *map[string]interface{}     `request:",omitempty"`

	SettingsHash string
	NoWait       bool
}

func (*UpdateRequest) ApplyRequest added in v2.9.0

func (req *UpdateRequest) ApplyRequest(ctx context.Context, caller sacloud.APICaller) (*ApplyRequest, error)

func (*UpdateRequest) Validate

func (req *UpdateRequest) Validate() error

type WaitBootRequest

type WaitBootRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`
}

func (*WaitBootRequest) Validate

func (req *WaitBootRequest) Validate() error

type WaitShutdownRequest

type WaitShutdownRequest struct {
	Zone string   `request:"-" validate:"required"`
	ID   types.ID `request:"-" validate:"required"`
}

func (*WaitShutdownRequest) Validate

func (req *WaitShutdownRequest) Validate() error

Jump to

Keyboard shortcuts

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