portal

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Md5Sum   string `json:"md5sum"`
	Filename string `json:"filename"`
	Name     string `json:"name"`
}

type Build

type Build struct {
	Version   string     `json:"version"`
	Date      time.Time  `json:"date"`
	Hash      string     `json:"hash"`
	Artifacts []Artifact `json:"artifacts"`
	Internal  bool       `json:"internal"`
}

func (*Build) GetBuildForDownload

func (b *Build) GetBuildForDownload(filename string) (Build, error)

type Builds

type Builds struct {
	Builds []Build `json:"builds"`
}

type HttpClient

type HttpClient interface {
	Do(*http.Request) (*http.Response, error)
}

type MockHttpClient

type MockHttpClient struct {
	mock.Mock
}

MockHttpClient is an autogenerated mock type for the HttpClient type

func NewMockHttpClient

func NewMockHttpClient(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockHttpClient

NewMockHttpClient creates a new instance of MockHttpClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockHttpClient) Do

func (_mock *MockHttpClient) Do(request *http.Request) (*http.Response, error)

Do provides a mock function for the type MockHttpClient

func (*MockHttpClient) EXPECT

type MockHttpClient_Do_Call

type MockHttpClient_Do_Call struct {
	*mock.Call
}

MockHttpClient_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do'

func (*MockHttpClient_Do_Call) Return

func (_c *MockHttpClient_Do_Call) Return(response *http.Response, err error) *MockHttpClient_Do_Call

func (*MockHttpClient_Do_Call) Run

func (_c *MockHttpClient_Do_Call) Run(run func(request *http.Request)) *MockHttpClient_Do_Call

func (*MockHttpClient_Do_Call) RunAndReturn

func (_c *MockHttpClient_Do_Call) RunAndReturn(run func(request *http.Request) (*http.Response, error)) *MockHttpClient_Do_Call

type MockHttpClient_Expecter

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

func (*MockHttpClient_Expecter) Do

func (_e *MockHttpClient_Expecter) Do(request interface{}) *MockHttpClient_Do_Call

Do is a helper method to define mock.On call

  • request

type MockPortal

type MockPortal struct {
	mock.Mock
}

MockPortal is an autogenerated mock type for the Portal type

func NewMockPortal

func NewMockPortal(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockPortal

NewMockPortal creates a new instance of MockPortal. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockPortal) DownloadBuildArtifact

func (_mock *MockPortal) DownloadBuildArtifact(product Product, build Build, file io.Writer) error

DownloadBuildArtifact provides a mock function for the type MockPortal

func (*MockPortal) EXPECT

func (_m *MockPortal) EXPECT() *MockPortal_Expecter

func (*MockPortal) GetBuild

func (_mock *MockPortal) GetBuild(product Product, version string, hash string) (Build, error)

GetBuild provides a mock function for the type MockPortal

func (*MockPortal) ListBuilds

func (_mock *MockPortal) ListBuilds(product Product) (Builds, error)

ListBuilds provides a mock function for the type MockPortal

func (*MockPortal) RegisterAPIKey

func (_mock *MockPortal) RegisterAPIKey(owner string, organization string, role string, expiresAt time.Time) error

RegisterAPIKey provides a mock function for the type MockPortal

func (*MockPortal) RevokeAPIKey

func (_mock *MockPortal) RevokeAPIKey(key string) error

RevokeAPIKey provides a mock function for the type MockPortal

type MockPortal_DownloadBuildArtifact_Call

type MockPortal_DownloadBuildArtifact_Call struct {
	*mock.Call
}

MockPortal_DownloadBuildArtifact_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DownloadBuildArtifact'

func (*MockPortal_DownloadBuildArtifact_Call) Return

func (*MockPortal_DownloadBuildArtifact_Call) Run

func (*MockPortal_DownloadBuildArtifact_Call) RunAndReturn

type MockPortal_Expecter

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

func (*MockPortal_Expecter) DownloadBuildArtifact

func (_e *MockPortal_Expecter) DownloadBuildArtifact(product interface{}, build interface{}, file interface{}) *MockPortal_DownloadBuildArtifact_Call

DownloadBuildArtifact is a helper method to define mock.On call

  • product
  • build
  • file

func (*MockPortal_Expecter) GetBuild

func (_e *MockPortal_Expecter) GetBuild(product interface{}, version interface{}, hash interface{}) *MockPortal_GetBuild_Call

GetBuild is a helper method to define mock.On call

  • product
  • version
  • hash

func (*MockPortal_Expecter) ListBuilds

func (_e *MockPortal_Expecter) ListBuilds(product interface{}) *MockPortal_ListBuilds_Call

ListBuilds is a helper method to define mock.On call

  • product

func (*MockPortal_Expecter) RegisterAPIKey

func (_e *MockPortal_Expecter) RegisterAPIKey(owner interface{}, organization interface{}, role interface{}, expiresAt interface{}) *MockPortal_RegisterAPIKey_Call

RegisterAPIKey is a helper method to define mock.On call

  • owner
  • organization
  • role
  • expiresAt

func (*MockPortal_Expecter) RevokeAPIKey

func (_e *MockPortal_Expecter) RevokeAPIKey(key interface{}) *MockPortal_RevokeAPIKey_Call

RevokeAPIKey is a helper method to define mock.On call

  • key

type MockPortal_GetBuild_Call

type MockPortal_GetBuild_Call struct {
	*mock.Call
}

MockPortal_GetBuild_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBuild'

func (*MockPortal_GetBuild_Call) Return

func (*MockPortal_GetBuild_Call) Run

func (_c *MockPortal_GetBuild_Call) Run(run func(product Product, version string, hash string)) *MockPortal_GetBuild_Call

func (*MockPortal_GetBuild_Call) RunAndReturn

func (_c *MockPortal_GetBuild_Call) RunAndReturn(run func(product Product, version string, hash string) (Build, error)) *MockPortal_GetBuild_Call

type MockPortal_ListBuilds_Call

type MockPortal_ListBuilds_Call struct {
	*mock.Call
}

MockPortal_ListBuilds_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListBuilds'

func (*MockPortal_ListBuilds_Call) Return

func (_c *MockPortal_ListBuilds_Call) Return(availablePackages Builds, err error) *MockPortal_ListBuilds_Call

func (*MockPortal_ListBuilds_Call) Run

func (*MockPortal_ListBuilds_Call) RunAndReturn

func (_c *MockPortal_ListBuilds_Call) RunAndReturn(run func(product Product) (Builds, error)) *MockPortal_ListBuilds_Call

type MockPortal_RegisterAPIKey_Call

type MockPortal_RegisterAPIKey_Call struct {
	*mock.Call
}

MockPortal_RegisterAPIKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterAPIKey'

func (*MockPortal_RegisterAPIKey_Call) Return

func (*MockPortal_RegisterAPIKey_Call) Run

func (_c *MockPortal_RegisterAPIKey_Call) Run(run func(owner string, organization string, role string, expiresAt time.Time)) *MockPortal_RegisterAPIKey_Call

func (*MockPortal_RegisterAPIKey_Call) RunAndReturn

func (_c *MockPortal_RegisterAPIKey_Call) RunAndReturn(run func(owner string, organization string, role string, expiresAt time.Time) error) *MockPortal_RegisterAPIKey_Call

type MockPortal_RevokeAPIKey_Call

type MockPortal_RevokeAPIKey_Call struct {
	*mock.Call
}

MockPortal_RevokeAPIKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RevokeAPIKey'

func (*MockPortal_RevokeAPIKey_Call) Return

func (*MockPortal_RevokeAPIKey_Call) Run

func (*MockPortal_RevokeAPIKey_Call) RunAndReturn

func (_c *MockPortal_RevokeAPIKey_Call) RunAndReturn(run func(key string) error) *MockPortal_RevokeAPIKey_Call

type Portal

type Portal interface {
	ListBuilds(product Product) (availablePackages Builds, err error)
	GetBuild(product Product, version string, hash string) (Build, error)
	DownloadBuildArtifact(product Product, build Build, file io.Writer) error
	RegisterAPIKey(owner string, organization string, role string, expiresAt time.Time) error
	RevokeAPIKey(key string) error
}

type PortalClient

type PortalClient struct {
	Env        env.Env
	HttpClient HttpClient
}

func NewPortalClient

func NewPortalClient() *PortalClient

func (*PortalClient) DownloadBuildArtifact

func (c *PortalClient) DownloadBuildArtifact(product Product, build Build, file io.Writer) error

func (*PortalClient) GetBody

func (c *PortalClient) GetBody(path string) (body []byte, status int, err error)

func (*PortalClient) GetBuild

func (c *PortalClient) GetBuild(product Product, version string, hash string) (Build, error)

func (*PortalClient) HttpRequest

func (c *PortalClient) HttpRequest(method string, path string, body []byte) (resp *http.Response, err error)

func (*PortalClient) ListBuilds

func (c *PortalClient) ListBuilds(product Product) (availablePackages Builds, err error)

func (*PortalClient) RegisterAPIKey

func (c *PortalClient) RegisterAPIKey(owner string, organization string, role string, expiresAt time.Time) error

func (*PortalClient) RevokeAPIKey

func (c *PortalClient) RevokeAPIKey(key string) error

type Product

type Product string
const (
	CodesphereProduct Product = "codesphere"
	OmsProduct        Product = "oms"
)

type WriteCounter

type WriteCounter struct {
	Written    int64
	LastUpdate time.Time
	Writer     io.Writer
	// contains filtered or unexported fields
}

WriteCounter is a custom io.Writer that counts bytes written and logs progress.

func NewWriteCounter

func NewWriteCounter(writer io.Writer) *WriteCounter

NewWriteCounter creates a new WriteCounter.

func (*WriteCounter) Write

func (wc *WriteCounter) Write(p []byte) (int, error)

Write implements the io.Writer interface for WriteCounter.

Jump to

Keyboard shortcuts

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