subscription

package
v0.0.0-...-67b10a3 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientGenerator

type ClientGenerator interface {
	NewClient(config SubscriptionRequest) SubscriptionGetter
}
var (
	SubscriptionClientGenerator ClientGenerator = &clientGenerator{}
)

type Creator

type Creator struct {
	Email     string `json:"email,omitempty" yaml:"email,omitempty"`
	FirstName string `json:"first_name,omitempty" yaml:"first_name,omitempty"`
	Href      string `json:"href,omitempty" yaml:"href,omitempty"`
	ID        string `json:"id,omitempty" yaml:"id,omitempty"`
	Kind      string `json:"kind,omitempty" yaml:"kind,omitempty"`
	LastName  string `json:"last_name,omitempty" yaml:"last_name,omitempty"`
	Name      string `json:"name,omitempty" yaml:"name,omitempty"`
	UserName  string `json:"username,omitempty" yaml:"username,omitempty"`
}

Creator ...

type ISubscriptionProvider

type ISubscriptionProvider interface {
	GetSubscriptions(request SubscriptionRequest) (*SubscriptionResponse, *SubscriptionError)
}
var (
	SubscriptionProvider ISubscriptionProvider = &subscriptionProvider{}
)

type Metrics

type Metrics struct {
	OpenShiftVersion string `json:"openshift_version,omitempty"`
}

Metrics ...

type StandardKind

type StandardKind struct {
	Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
	ID   string `json:"id,omitempty" yaml:"id,omitempty"`
	Href string `json:"href,omitempty" yaml:"href,omitempty"`
	Type string `json:"type,omitempty" yaml:"type,omitempty"`
}

StandardKind ...

type Subscription

type Subscription struct {
	ClusterID         string       `json:"cluster_id,omitempty" yaml:"cluster_id,omitempty"`
	CloudProviderID   string       `json:"cloud_provider_id,omitempty" yaml:"cloud_provider_id,omitempty"`
	ConsoleURL        string       `json:"console_url,omitempty" yaml:"console_url,omitempty"`
	CreatedAt         *metav1.Time `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	Creator           Creator      `json:"creator" yaml:"creator"`
	DisplayName       string       `json:"display_name,omitempty" yaml:"display_name,omitempty"`
	ExternalClusterID string       `json:"external_cluster_id,omitempty" yaml:"external_cluster_id,omitempty"`
	Href              string       `json:"href" yaml:"href"`
	ID                string       `json:"id" yaml:"id"`
	Kind              string       `json:"kind" yaml:"kind"`
	LastReconcileDate *metav1.Time `json:"last_reconcile_date,omitempty" yaml:"last_reconcile_date,omitempty"`
	LastReleasedAt    string       `json:"last_released_at,omitempty" yaml:"last_released_at,omitempty"`
	LastTelemetryDate *metav1.Time `json:"last_telemetry_date,omitempty" yaml:"last_telemetry_date,omitempty"`
	Managed           bool         `json:"managed,omitempty" yaml:"managed,omitempty"`
	Metrics           []Metrics    `json:"metrics,omitempty" yaml:"metrics,omitempty"`
	OrganizationID    string       `json:"organization_id,omitempty" yaml:"organization_id,omitempty"`
	Plan              StandardKind `json:"plan,omitempty" yaml:"plan,omitempty"`
	Provenance        string       `json:"provenance,omitempty" yaml:"provenance,omitempty"`
	RegionID          string       `json:"region_id,omitempty" yaml:"region_id,omitempty"`
	Status            string       `json:"status" yaml:"status"`
	SupportLevel      string       `json:"support_level,omitempty" yaml:"support_level,omitempty"`
	UpdatedAt         *metav1.Time `json:"updated_at,omitempty" yaml:"updated_at,omitempty"`
}

Subscription ...

func Filter

func Filter(subs []Subscription, f discovery.Filter) []Subscription

Filter creates filter functions based on the provided filter spec and returns only the list of subscriptions that pass all filters

type SubscriptionError

type SubscriptionError struct {
	Kind       string `json:"kind"`
	ID         string `json:"id"`
	Href       string `json:"href"`
	Code       string `json:"code"`
	Reason     string `json:"reason"`
	StatusCode int    `json:"status_code,omitempty"`
	// Error is for setting an internal error for tracking
	Error error `json:"-"`
	// Response is for storing the raw response on an error
	Response []byte `json:"-"`
}

SubscriptionError represents the error format response by OCM on a subscription request. Full list of responses available at https://api.openshift.com/api/accounts_mgmt/v1/errors/

type SubscriptionGetInterface

type SubscriptionGetInterface interface {
	Get(*http.Request) (*http.Response, error)
}

type SubscriptionGetter

type SubscriptionGetter interface {
	GetSubscriptions() ([]Subscription, error)
}

func NewClient

func NewClient(config SubscriptionRequest) SubscriptionGetter

type SubscriptionRequest

type SubscriptionRequest struct {
	BaseURL string
	Token   string
	Page    int
	Size    int
	Filter  discovery.Filter
}

SubscriptionRequest contains the data used to customize a subscription get request

type SubscriptionResponse

type SubscriptionResponse struct {
	Kind  string         `json:"kind"`
	Page  int            `json:"page"`
	Size  int            `json:"size"`
	Total int            `json:"total"`
	Items []Subscription `json:"items"`
}

SubscriptionResponse ...

Jump to

Keyboard shortcuts

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