types

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2019 License: Apache-2.0, BSD-3-Clause, MIT Imports: 8 Imported by: 22

Documentation

Overview

Package types contains the Service Manager web entities

Index

Constants

View Source
const (
	// CREATED represents a notification type for creating a resource
	CREATED OperationType = "CREATED"

	// MODIFIED represents a notification type for modifying a resource
	MODIFIED OperationType = "MODIFIED"

	// DELETED represents a notification type for deleting a resource
	DELETED OperationType = "DELETED"

	// InvalidRevision revision with invalid value
	InvalidRevision int64 = -1
)
View Source
const K8sPlatformType string = "kubernetes"

Variables

This section is empty.

Functions

This section is empty.

Types

type Base added in v0.2.0

type Base struct {
	ID             string    `json:"id"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	Labels         Labels    `json:"labels,omitempty"`
	PagingSequence int64     `json:"-"`
}

func (*Base) GetCreatedAt added in v0.2.0

func (e *Base) GetCreatedAt() time.Time

func (*Base) GetID added in v0.2.0

func (e *Base) GetID() string

func (*Base) GetLabels added in v0.2.0

func (e *Base) GetLabels() Labels

func (*Base) GetPagingSequence added in v0.6.0

func (e *Base) GetPagingSequence() int64

func (*Base) GetUpdatedAt added in v0.2.0

func (e *Base) GetUpdatedAt() time.Time

func (*Base) SetCreatedAt added in v0.2.0

func (e *Base) SetCreatedAt(time time.Time)

func (*Base) SetID added in v0.2.0

func (e *Base) SetID(id string)

func (*Base) SetLabels added in v0.2.0

func (e *Base) SetLabels(labels Labels)

func (*Base) SetUpdatedAt added in v0.2.0

func (e *Base) SetUpdatedAt(time time.Time)

type Basic

type Basic struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

Basic basic credentials

type Credentials

type Credentials struct {
	Basic *Basic `json:"basic,omitempty"`
}

Credentials credentials

func GenerateCredentials

func GenerateCredentials() (*Credentials, error)

GenerateCredentials return user and password

func (*Credentials) MarshalJSON added in v0.1.2

func (c *Credentials) MarshalJSON() ([]byte, error)

func (*Credentials) Validate

func (c *Credentials) Validate() error

Validate implements InputValidator and verifies all mandatory fields are populated

type Labels added in v0.1.8

type Labels map[string][]string

Labels represents key values pairs associated with resources

func (Labels) Validate added in v0.1.8

func (l Labels) Validate() error

type Notification added in v0.3.0

type Notification struct {
	Base
	Resource      ObjectType      `json:"resource"`
	Type          OperationType   `json:"type"`
	PlatformID    string          `json:"platform_id,omitempty"`
	Revision      int64           `json:"revision"`
	Payload       json.RawMessage `json:"payload"`
	CorrelationID string          `json:"correlation_id"`
}

Notification struct

func (*Notification) GetType added in v0.3.0

func (e *Notification) GetType() ObjectType

func (*Notification) MarshalJSON added in v0.3.0

func (e *Notification) MarshalJSON() ([]byte, error)

MarshalJSON override json serialization for http response

func (*Notification) Validate added in v0.3.0

func (n *Notification) Validate() error

Validate implements InputValidator and verifies all mandatory fields are populated

type Notifications added in v0.3.0

type Notifications struct {
	Notifications []*Notification `json:"notifications"`
}

func (*Notifications) Add added in v0.3.0

func (e *Notifications) Add(object Object)

func (*Notifications) ItemAt added in v0.3.0

func (e *Notifications) ItemAt(index int) Object

func (*Notifications) Len added in v0.3.0

func (e *Notifications) Len() int

type Object added in v0.2.0

type Object interface {
	util.InputValidator

	SetID(id string)
	GetID() string
	GetType() ObjectType
	GetLabels() Labels
	SetLabels(labels Labels)
	SetCreatedAt(time time.Time)
	GetCreatedAt() time.Time
	SetUpdatedAt(time time.Time)
	GetUpdatedAt() time.Time
	GetPagingSequence() int64
}

Object is the common interface that all resources in the Service Manager must implement

type ObjectList added in v0.2.0

type ObjectList interface {
	Add(object Object)
	ItemAt(index int) Object
	Len() int
}

ObjectList is the interface that lists of objects must implement

type ObjectPage added in v0.6.0

type ObjectPage struct {
	//Token represents the base64 encoded paging_sequence of the last entity in items list
	Token      string   `json:"token,omitempty"`
	ItemsCount int      `json:"num_items"`
	Items      []Object `json:"items"`
}

ObjectPage is the DTO for a given page of resources when listing

type ObjectType added in v0.2.0

type ObjectType string

ObjectType is the type of the object in the Service Manager

const NotificationType ObjectType = "types.Notification"
const PlatformType ObjectType = "types.Platform"
const ServiceBrokerType ObjectType = "types.ServiceBroker"
const ServiceOfferingType ObjectType = "types.ServiceOffering"
const ServicePlanType ObjectType = "types.ServicePlan"
const VisibilityType ObjectType = "types.Visibility"

type OperationType added in v0.3.0

type OperationType string

OperationType is the notification type

type Platform

type Platform struct {
	Base
	Secured     `json:"-"`
	Type        string       `json:"type"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Credentials *Credentials `json:"credentials,omitempty"`
	Active      bool         `json:"-"`
	LastActive  time.Time    `json:"-"`
}

Platform platform struct

func (*Platform) GetCredentials added in v0.2.0

func (e *Platform) GetCredentials() *Credentials

func (*Platform) GetType added in v0.2.0

func (e *Platform) GetType() ObjectType

func (*Platform) MarshalJSON

func (e *Platform) MarshalJSON() ([]byte, error)

MarshalJSON override json serialization for http response

func (*Platform) SetCredentials added in v0.2.0

func (e *Platform) SetCredentials(credentials *Credentials)

func (*Platform) Validate

func (e *Platform) Validate() error

Validate implements InputValidator and verifies all mandatory fields are populated

type Platforms added in v0.2.0

type Platforms struct {
	Platforms []*Platform `json:"platforms"`
}

func (*Platforms) Add added in v0.2.0

func (e *Platforms) Add(object Object)

func (*Platforms) ItemAt added in v0.2.0

func (e *Platforms) ItemAt(index int) Object

func (*Platforms) Len added in v0.2.0

func (e *Platforms) Len() int

type Secured added in v0.2.0

type Secured interface {
	SetCredentials(credentials *Credentials)
	GetCredentials() *Credentials
}

Secured interface indicates that an object requires credentials to access it

type ServiceBroker added in v0.2.0

type ServiceBroker struct {
	Base
	Secured     `json:"-"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
	BrokerURL   string       `json:"broker_url"`
	Credentials *Credentials `json:"credentials,omitempty" structs:"-"`

	Catalog  json.RawMessage    `json:"-" structs:"-"`
	Services []*ServiceOffering `json:"-" structs:"-"`
}

ServiceBroker broker struct

func (*ServiceBroker) GetCredentials added in v0.2.0

func (e *ServiceBroker) GetCredentials() *Credentials

func (*ServiceBroker) GetType added in v0.2.0

func (e *ServiceBroker) GetType() ObjectType

func (*ServiceBroker) MarshalJSON added in v0.2.0

func (e *ServiceBroker) MarshalJSON() ([]byte, error)

MarshalJSON override json serialization for http response

func (*ServiceBroker) SetCredentials added in v0.2.0

func (e *ServiceBroker) SetCredentials(credentials *Credentials)

func (*ServiceBroker) Validate added in v0.2.0

func (e *ServiceBroker) Validate() error

Validate implements InputValidator and verifies all mandatory fields are populated

type ServiceBrokers added in v0.2.0

type ServiceBrokers struct {
	ServiceBrokers []*ServiceBroker `json:"service_brokers"`
}

func (*ServiceBrokers) Add added in v0.2.0

func (e *ServiceBrokers) Add(object Object)

func (*ServiceBrokers) ItemAt added in v0.2.0

func (e *ServiceBrokers) ItemAt(index int) Object

func (*ServiceBrokers) Len added in v0.2.0

func (e *ServiceBrokers) Len() int

type ServiceOffering added in v0.1.2

type ServiceOffering struct {
	Base

	Name                 string `json:"name"`
	Description          string `json:"description"`
	Bindable             bool   `json:"bindable"`
	InstancesRetrievable bool   `json:"instances_retrievable"`
	BindingsRetrievable  bool   `json:"bindings_retrievable"`
	PlanUpdatable        bool   `json:"plan_updateable"`

	Tags     json.RawMessage `json:"tags,omitempty"`
	Requires json.RawMessage `json:"requires,omitempty"`
	Metadata json.RawMessage `json:"metadata,omitempty"`

	BrokerID    string `json:"broker_id"`
	CatalogID   string `json:"catalog_id"`
	CatalogName string `json:"catalog_name"`

	Plans []*ServicePlan `json:"plans"`
}

Service Offering struct

func (*ServiceOffering) GetType added in v0.2.0

func (e *ServiceOffering) GetType() ObjectType

func (*ServiceOffering) MarshalJSON added in v0.1.2

func (e *ServiceOffering) MarshalJSON() ([]byte, error)

MarshalJSON override json serialization for http response

func (*ServiceOffering) Validate added in v0.1.2

func (e *ServiceOffering) Validate() error

Validate implements InputValidator and verifies all mandatory fields are populated

type ServiceOfferings added in v0.1.6

type ServiceOfferings struct {
	ServiceOfferings []*ServiceOffering `json:"service_offerings"`
}

func (*ServiceOfferings) Add added in v0.2.0

func (e *ServiceOfferings) Add(object Object)

func (*ServiceOfferings) ItemAt added in v0.2.0

func (e *ServiceOfferings) ItemAt(index int) Object

func (*ServiceOfferings) Len added in v0.2.0

func (e *ServiceOfferings) Len() int

type ServicePlan added in v0.1.2

type ServicePlan struct {
	Base
	Name        string `json:"name"`
	Description string `json:"description"`

	CatalogID     string `json:"catalog_id"`
	CatalogName   string `json:"catalog_name"`
	Free          bool   `json:"free"`
	Bindable      bool   `json:"bindable"`
	PlanUpdatable bool   `json:"plan_updateable"`

	Metadata json.RawMessage `json:"metadata,omitempty"`
	Schemas  json.RawMessage `json:"schemas,omitempty"`

	ServiceOfferingID string `json:"service_offering_id"`
}

Service Plan struct

func (*ServicePlan) GetType added in v0.2.0

func (e *ServicePlan) GetType() ObjectType

func (*ServicePlan) MarshalJSON added in v0.1.2

func (e *ServicePlan) MarshalJSON() ([]byte, error)

MarshalJSON override json serialization for http response

func (*ServicePlan) Validate added in v0.1.2

func (e *ServicePlan) Validate() error

Validate implements InputValidator and verifies all mandatory fields are populated

type ServicePlans added in v0.1.8

type ServicePlans struct {
	ServicePlans []*ServicePlan `json:"service_plans"`
}

func (*ServicePlans) Add added in v0.2.0

func (e *ServicePlans) Add(object Object)

func (*ServicePlans) ItemAt added in v0.2.0

func (e *ServicePlans) ItemAt(index int) Object

func (*ServicePlans) Len added in v0.2.0

func (e *ServicePlans) Len() int

type Visibilities added in v0.1.6

type Visibilities struct {
	Visibilities []*Visibility `json:"visibilities"`
}

func (*Visibilities) Add added in v0.2.0

func (e *Visibilities) Add(object Object)

func (*Visibilities) ItemAt added in v0.2.0

func (e *Visibilities) ItemAt(index int) Object

func (*Visibilities) Len added in v0.2.0

func (e *Visibilities) Len() int

type Visibility added in v0.1.6

type Visibility struct {
	Base
	PlatformID    string `json:"platform_id"`
	ServicePlanID string `json:"service_plan_id"`
}

Visibility struct

func (*Visibility) GetType added in v0.2.0

func (e *Visibility) GetType() ObjectType

func (*Visibility) MarshalJSON added in v0.1.6

func (e *Visibility) MarshalJSON() ([]byte, error)

MarshalJSON override json serialization for http response

func (*Visibility) Validate added in v0.1.6

func (e *Visibility) Validate() error

Validate implements InputValidator and verifies all mandatory fields are populated

Jump to

Keyboard shortcuts

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