subscriptions

package
v0.14.0 Latest Latest
Warning

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

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

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 FixedSubscription) (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) (*FixedSubscription, error)

Get will retrieve an existing fixed subscription.

func (*API) List

func (a *API) List(ctx context.Context) ([]*FixedSubscription, 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 FixedSubscription) error

Update will make changes to an existing fixed subscription.

type FixedSubscription

type FixedSubscription struct {
	ID              *int       `json:"id,omitempty"` // Omit for Create and Update
	Name            *string    `json:"name,omitempty"`
	Status          *string    `json:"status,omitempty"` // Omit for Create and Update
	PlanId          *int       `json:"planId,omitempty"`
	PaymentMethodID *int       `json:"paymentMethodId,omitempty"`
	CreationDate    *time.Time `json:"creationDate,omitempty"` // Omit for Create and Update
}

func (FixedSubscription) String

func (o FixedSubscription) 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