Documentation ¶
Index ¶
- func Compare(lhs, rhs UID) int
- func NewObjectUpdater(db Database) *objectUpdater
- type ApiClient
- func (m *ApiClient) AddInterceptor(typename string, interceptor TypeInterceptor)
- func (m *ApiClient) Create(ptr contrail.IObject) error
- func (m *ApiClient) Delete(ptr contrail.IObject) error
- func (m *ApiClient) DeleteByUuid(typename string, id string) error
- func (m *ApiClient) FQNameByUuid(id string) ([]string, error)
- func (m *ApiClient) FindByName(typename string, fqn string) (contrail.IObject, error)
- func (m *ApiClient) FindByUuid(typename string, id string) (contrail.IObject, error)
- func (m *ApiClient) Init()
- func (m *ApiClient) List(typename string) ([]contrail.ListResult, error)
- func (m *ApiClient) ListByParent(typename string, parentID string) ([]contrail.ListResult, error)
- func (m *ApiClient) ListDetail(typename string, fields []string) ([]contrail.IObject, error)
- func (m *ApiClient) ListDetailByParent(typename string, parentID string, fields []string) ([]contrail.IObject, error)
- func (m *ApiClient) Update(ptr contrail.IObject) error
- func (m *ApiClient) UuidByName(typename string, fqn string) (string, error)
- type Database
- type InMemDatabase
- func (db *InMemDatabase) Delete(obj contrail.IObject) error
- func (db *InMemDatabase) GetBackReferences(uid UID, typename string) (UIDList, error)
- func (db *InMemDatabase) GetByName(typename string, fqn string) (contrail.IObject, error)
- func (db *InMemDatabase) GetByUUID(id uuid.UUID) (contrail.IObject, error)
- func (db *InMemDatabase) GetChildren(uid UID, typename string) (UIDList, error)
- func (db *InMemDatabase) List(typename string) []contrail.IObject
- func (db *InMemDatabase) Put(obj contrail.IObject, parent contrail.IObject, refs UIDList) error
- func (db *InMemDatabase) Update(obj contrail.IObject, refs UIDList) error
- type ObjectData
- type ReferenceMap
- type TypeInterceptor
- type TypeMap
- type UID
- type UIDList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewObjectUpdater ¶
func NewObjectUpdater(db Database) *objectUpdater
NewObjectUpdater returns an object the implements the contrail.objectInterface interface. These are the methods provoded to the generated types classes that allow them to manage get, add and delete operations on references.
Types ¶
type ApiClient ¶
type ApiClient struct { IDAssignMap map[string]string InterceptorMap map[string]TypeInterceptor // contains filtered or unexported fields }
ApiClient mocks the contrail.ApiClient interface.
func (*ApiClient) AddInterceptor ¶
func (m *ApiClient) AddInterceptor(typename string, interceptor TypeInterceptor)
AddInterceptor is used to apply a type-specific hook for GET and PUT requests.
func (*ApiClient) DeleteByUuid ¶
DeleteByUuid removes the object identified by the specified uuid.
func (*ApiClient) FQNameByUuid ¶
FQNameByUuid retrieves the fully qualified name corresponding to a UUID.
func (*ApiClient) FindByName ¶
FindByName reads the database object identified by a colon (:) delimited string.
func (*ApiClient) FindByUuid ¶
FindByUuid retrieves the object specified by uuid.
func (*ApiClient) Init ¶
func (m *ApiClient) Init()
Init initializes the database with default values such as the default-project and ipam.
func (*ApiClient) ListByParent ¶
ListByParent retrieves the identifiers of objects of the specified type that are descendents of parent (as identified by UUID)
func (*ApiClient) ListDetail ¶
ListDetail reads all the objects of a given type.
func (*ApiClient) ListDetailByParent ¶
func (m *ApiClient) ListDetailByParent(typename string, parentID string, fields []string) ([]contrail.IObject, error)
ListDetailByParent reads all the objects of the specified type that are descendants of the parent object (as specified by UUID).
type Database ¶
type Database interface { Put(obj contrail.IObject, parent contrail.IObject, refs UIDList) error Update(obj contrail.IObject, refs UIDList) error Delete(obj contrail.IObject) error GetByUUID(id uuid.UUID) (contrail.IObject, error) GetByName(typename string, fqn string) (contrail.IObject, error) List(typename string) []contrail.IObject GetChildren(uid UID, typename string) (UIDList, error) GetBackReferences(uid UID, typename string) (UIDList, error) }
Database defines the interface used to mock the behavior of the contrail API server.
func NewInMemDatabase ¶
func NewInMemDatabase() Database
NewInMemDatabase creates and initializes a InMemDatabase.
type InMemDatabase ¶
type InMemDatabase struct {
// contains filtered or unexported fields
}
InMemDatabase implements the Database interface.
func (*InMemDatabase) Delete ¶
func (db *InMemDatabase) Delete(obj contrail.IObject) error
Delete an object and any back references on objects that it refers to. Deletes as rejected for objects that have children or back references mimicing the behavior of the Contrail API server.
func (*InMemDatabase) GetBackReferences ¶
func (db *InMemDatabase) GetBackReferences(uid UID, typename string) (UIDList, error)
GetBackReferences retrieves the list of back references.
func (*InMemDatabase) GetByName ¶
func (db *InMemDatabase) GetByName(typename string, fqn string) (contrail.IObject, error)
GetByName retrieves an object specified by colon separated fully qualified name.
func (*InMemDatabase) GetByUUID ¶
func (db *InMemDatabase) GetByUUID(id uuid.UUID) (contrail.IObject, error)
GetByUUID retrieves and object by UUID.
func (*InMemDatabase) GetChildren ¶
func (db *InMemDatabase) GetChildren(uid UID, typename string) (UIDList, error)
GetChildren retrieves the list of children.
func (*InMemDatabase) List ¶
func (db *InMemDatabase) List(typename string) []contrail.IObject
List retrieves all objects of a given type.
func (*InMemDatabase) Put ¶
func (db *InMemDatabase) Put(obj contrail.IObject, parent contrail.IObject, refs UIDList) error
Put adds an object to the database and updates the children list on the parent and the back_references lists of objects that obj refers to.
func (*InMemDatabase) Update ¶
func (db *InMemDatabase) Update(obj contrail.IObject, refs UIDList) error
Update an object in the database, modifying corresponding references (forward and back).
type ObjectData ¶
type ObjectData struct {
// contains filtered or unexported fields
}
ObjectData stores reference data
type TypeInterceptor ¶
type TypeInterceptor interface { Get(contrail.IObject) Put(contrail.IObject) }
TypeInterceptor defines an interface that intercepts Put and Get requests to the API. Typically used to simulate API server behavior that is type specific. An example is the API server determining the Gateway address on a Subnet.
type TypeMap ¶
type TypeMap map[string]contrail.IObject
TypeMap stores per typename map of name to object.