opensearchbackupservice

package
v0.0.0-...-f4fdb20 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TestIndexMapping = `` /* 154-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type IMockHttpClient

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

func MockHttpClient

func MockHttpClient(responseMock string) *IMockHttpClient

func (*IMockHttpClient) Do

type IOSS3BackupService

type IOSS3BackupService interface {
	OSS3BackupVerify(models.S3BackupDetails, *fiber.Ctx) (models.S3BackupManagedResponse, error)
}

type IOpenSearchclient

type IOpenSearchclient interface {
	CreateAWSClient(models.S3BackupDetails, string) (*elastic.Client, error)
}

func SetupMockOpensearchClient

func SetupMockOpensearchClient(responseMock string) IOpenSearchclient

type IOpensearchOperations

type IOpensearchOperations interface {
	CreateTestIndex(*elastic.Client, *fiber.Ctx, string) (bool, error)
	CreateSnapshotRepo(*elastic.Client, *fiber.Ctx, SnapshotRepoRequestS3, string) (bool, error)
	CreateSnapshot(*elastic.Client, *fiber.Ctx, string, string, string) (bool, error)
	GetSnapshotStatus(*elastic.Client, *fiber.Ctx, string, string) (string, error)
	DeleteTestSnapshot(*elastic.Client, *fiber.Ctx, string, string) (bool, error)
	DeleteTestSnapshotRepo(*elastic.Client, *fiber.Ctx, string) (bool, error)
	DeleteTestIndex(*elastic.Client, *fiber.Ctx, string) (bool, error)
}

func SetupMockOSOperations

func SetupMockOSOperations(resp []TestMockFunc) IOpensearchOperations

type MockOSOperations

type MockOSOperations struct {
	CreateTestIndexFunc        func(*elastic.Client, *fiber.Ctx, string) (bool, error)
	CreateSnapshotRepoFunc     func(*elastic.Client, *fiber.Ctx, SnapshotRepoRequestS3, string) (bool, error)
	CreateSnapshotFunc         func(*elastic.Client, *fiber.Ctx, string, string, string) (bool, error)
	GetSnapshotStatusFunc      func(*elastic.Client, *fiber.Ctx, string, string) (string, error)
	DeleteTestSnapshotFunc     func(*elastic.Client, *fiber.Ctx, string, string) (bool, error)
	DeleteTestSnapshotRepoFunc func(*elastic.Client, *fiber.Ctx, string) (bool, error)
	DeleteTestIndexFunc        func(*elastic.Client, *fiber.Ctx, string) (bool, error)
}

func (*MockOSOperations) CreateSnapshot

func (mco *MockOSOperations) CreateSnapshot(client *elastic.Client, ctx *fiber.Ctx, repoName string, snapshotName string, index string) (bool, error)

func (*MockOSOperations) CreateSnapshotRepo

func (mco *MockOSOperations) CreateSnapshotRepo(client *elastic.Client, ctx *fiber.Ctx, req SnapshotRepoRequestS3, repo string) (bool, error)

func (*MockOSOperations) CreateTestIndex

func (mco *MockOSOperations) CreateTestIndex(client *elastic.Client, ctx *fiber.Ctx, index string) (bool, error)

func (*MockOSOperations) DeleteTestIndex

func (mco *MockOSOperations) DeleteTestIndex(client *elastic.Client, ctx *fiber.Ctx, index string) (bool, error)

func (*MockOSOperations) DeleteTestSnapshot

func (mco *MockOSOperations) DeleteTestSnapshot(client *elastic.Client, ctx *fiber.Ctx, repoName string, snapshotName string) (bool, error)

func (*MockOSOperations) DeleteTestSnapshotRepo

func (mco *MockOSOperations) DeleteTestSnapshotRepo(client *elastic.Client, ctx *fiber.Ctx, repoName string) (bool, error)

func (*MockOSOperations) GetSnapshotStatus

func (mco *MockOSOperations) GetSnapshotStatus(client *elastic.Client, ctx *fiber.Ctx, repoName string, snapshotName string) (string, error)

type MockOSS3BackupService

type MockOSS3BackupService struct {
	OSS3BackupVerifyFunc func(models.S3BackupDetails, *fiber.Ctx) (models.S3BackupManagedResponse, error)
}

func (*MockOSS3BackupService) OSS3BackupVerify

func (mos *MockOSS3BackupService) OSS3BackupVerify(request models.S3BackupDetails, ctx *fiber.Ctx) (models.S3BackupManagedResponse, error)

type MockOpensearchClient

type MockOpensearchClient struct {
	CreateAWSClientFunc func(models.S3BackupDetails, string) (*elastic.Client, error)
}

func (*MockOpensearchClient) CreateAWSClient

func (osc *MockOpensearchClient) CreateAWSClient(req models.S3BackupDetails, url string) (*elastic.Client, error)

type OSS3BackupService

type OSS3BackupService struct {
	OSClient     IOpenSearchclient
	OSOperations IOpensearchOperations
	Log          logger.Logger
}

func NewOSS3BackupService

func NewOSS3BackupService(log logger.Logger) *OSS3BackupService

func (*OSS3BackupService) OSS3BackupVerify

func (ss *OSS3BackupService) OSS3BackupVerify(request models.S3BackupDetails, ctx *fiber.Ctx) (models.S3BackupManagedResponse, error)

type OpenSearchclient

type OpenSearchclient struct{}

func NewOpenSearchclient

func NewOpenSearchclient() *OpenSearchclient

func (*OpenSearchclient) CreateAWSClient

func (os *OpenSearchclient) CreateAWSClient(request models.S3BackupDetails, url string) (*elastic.Client, error)

type OpensearchOperations

type OpensearchOperations struct {
	Log logger.Logger
}

func NewOpensearchOperations

func NewOpensearchOperations(log logger.Logger) *OpensearchOperations

func (*OpensearchOperations) CreateSnapshot

func (os *OpensearchOperations) CreateSnapshot(client *elastic.Client, ctx *fiber.Ctx, repoName string, snapshotName string, index string) (bool, error)

func (*OpensearchOperations) CreateSnapshotRepo

func (os *OpensearchOperations) CreateSnapshotRepo(client *elastic.Client, ctx *fiber.Ctx, req SnapshotRepoRequestS3, repoName string) (bool, error)

func (*OpensearchOperations) CreateTestIndex

func (os *OpensearchOperations) CreateTestIndex(client *elastic.Client, ctx *fiber.Ctx, index string) (bool, error)

func (*OpensearchOperations) DeleteTestIndex

func (os *OpensearchOperations) DeleteTestIndex(client *elastic.Client, ctx *fiber.Ctx, index string) (bool, error)

func (*OpensearchOperations) DeleteTestSnapshot

func (os *OpensearchOperations) DeleteTestSnapshot(client *elastic.Client, ctx *fiber.Ctx, repoName string, snapshotName string) (bool, error)

func (*OpensearchOperations) DeleteTestSnapshotRepo

func (os *OpensearchOperations) DeleteTestSnapshotRepo(client *elastic.Client, ctx *fiber.Ctx, repoName string) (bool, error)

func (*OpensearchOperations) GetSnapshotStatus

func (os *OpensearchOperations) GetSnapshotStatus(client *elastic.Client, ctx *fiber.Ctx, repoName string, snapshotName string) (string, error)

type SnapshotRepoRequest

type SnapshotRepoRequest struct {
	Type     string                 `json:"type"`
	Settings map[string]interface{} `json:"settings"`
}

type SnapshotRepoRequestS3

type SnapshotRepoRequestS3 struct {
	Bucket   string
	BasePath string
	RoleArn  string
	Region   string
}

type SnapshotRequest

type SnapshotRequest struct {
	Indices           string `json:"indices"`
	IgnoreUnavailable bool   `json:"ignore_unavailable"`
	AllowNoIndices    bool   `json:"allow_no_indices"`
}

type SnapshotStatus

type SnapshotStatus struct {
	Snapshots []snapshotStatus `json:"snapshots"`
}

type TestMockFunc

type TestMockFunc struct {
	TestCase bool
	Err      error
}

Jump to

Keyboard shortcuts

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