subscriptions

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// FixedSubscriptionStatusActive is the active value of the `Status` field in `Subscription`
	FixedSubscriptionStatusActive = "active"
	// FixedSubscriptionStatusPending is the pending value of the `Status` field in `Subscription`
	FixedSubscriptionStatusPending = "pending"
	// FixedSubscriptionStatusError is the error value of the `Status` field in `Subscription`
	FixedSubscriptionStatusError = "error"
	// FixedSubscriptionStatusDeleting is the deleting value of the `Status` field in `Subscription`
	FixedSubscriptionStatusDeleting = "deleting"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func NewAPI

func NewAPI(client HttpClient, taskWaiter TaskWaiter, logger Log) *API

func (*API) Create

func (a *API) Create(ctx context.Context, subscription FixedSubscriptionRequest) (int, error)

Create will create a new subscription.

func (*API) Delete

func (a *API) Delete(ctx context.Context, id int) error

Delete will destroy an existing subscription. All existing databases within the subscription should already be deleted, otherwise this function will fail.

func (*API) Get

func (a *API) Get(ctx context.Context, id int) (*FixedSubscriptionResponse, error)

Get will retrieve an existing fixed subscription.

func (*API) List

func (a *API) List(ctx context.Context) ([]*FixedSubscriptionResponse, error)

List will list all of the current account's fixed subscriptions.

func (*API) Update

func (a *API) Update(ctx context.Context, id int, subscription FixedSubscriptionRequest) error

Update will make changes to an existing fixed subscription.

type FixedSubscriptionRequest added in v0.27.0

type FixedSubscriptionRequest struct {
	Name            *string `json:"name,omitempty"`
	PlanId          *int    `json:"planId,omitempty"`
	PaymentMethod   *string `json:"paymentMethod,omitempty"`
	PaymentMethodID *int    `json:"paymentMethodId,omitempty"`
}

Represents request information to create/update a fixed subscription

func (FixedSubscriptionRequest) String added in v0.27.0

func (o FixedSubscriptionRequest) String() string

type FixedSubscriptionResponse added in v0.27.0

type FixedSubscriptionResponse struct {
	ID              *int       `json:"id,omitempty"`
	Name            *string    `json:"name,omitempty"`
	Status          *string    `json:"status,omitempty"`
	PlanId          *int       `json:"planId,omitempty"`
	PaymentMethod   *string    `json:"paymentMethodType,omitempty"`
	PaymentMethodID *int       `json:"paymentMethodId,omitempty"`
	CreationDate    *time.Time `json:"creationDate,omitempty"`
}

Represents subscription info response from the get/list endpoints

func (FixedSubscriptionResponse) String added in v0.27.0

func (o FixedSubscriptionResponse) String() string

type HttpClient

type HttpClient interface {
	Get(ctx context.Context, name, path string, responseBody interface{}) error
	Post(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error
	Put(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error
	Delete(ctx context.Context, name, path string, responseBody interface{}) error
}

type Log

type Log interface {
	Printf(format string, args ...interface{})
}

type NotFound

type NotFound struct {
	ID int
}

func (*NotFound) Error

func (f *NotFound) Error() string

type TaskWaiter

type TaskWaiter interface {
	WaitForResourceId(ctx context.Context, id string) (int, error)
	Wait(ctx context.Context, id string) error
}

Jump to

Keyboard shortcuts

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