Documentation
¶
Index ¶
- func FilterProfileKeys(profile map[string]interface{}, validKeys []string) map[string]interface{}
- func FilterReturnFields(required, allowed []string) []string
- func GetObjectTypeFromRef(ref string) string
- type Client
- func (client Client) Create(objType string, profile interface{}) (string, error)
- func (client Client) CreateAndRead(objType string, profile interface{}) (map[string]interface{}, error)
- func (client Client) Delete(objRef string) (string, error)
- func (client Client) FilterProfileAttrs(objType string, profile map[string]interface{}, filter []string)
- func (client Client) GetObjectSchema(objType string) (map[string]interface{}, error)
- func (client Client) GetValidKeys(objType string, filter []string) []string
- func (client Client) Read(objRef string, returnFields []string, obj interface{}) error
- func (client Client) ReadAll(objType string) ([]map[string]interface{}, error)
- func (client Client) Update(objRef string, newProfile interface{}) (string, error)
- func (client Client) UpdateAndRead(objRef string, newProfile interface{}) (map[string]interface{}, error)
- type Params
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterProfileKeys ¶
FilterProfileKeys - filters the keys of the provided map, deleting the ones not contained in the valid keys list
func FilterReturnFields ¶
FilterReturnFields - filters the list of required return fields based on the list of readable ones
func GetObjectTypeFromRef ¶
GetObjectTypeFromRef - returns the object type given an object reference Object reference format: wapitype / refdata [ : name1 [ { / nameN }... ] ]
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client : the infoblox client
func (Client) Create ¶
Create - creates an object returns an array with these fields: - the created object reference ("" in case of errors) - the error (nil in case of success)
func (Client) CreateAndRead ¶
func (client Client) CreateAndRead(objType string, profile interface{}) (map[string]interface{}, error)
CreateAndRead - Creates the object and, upon success, reads it back returns the newly create object profile or error otherwise
func (Client) Delete ¶
Delete - deletes an object returns an array with these fields: - the deleted object reference ("" in case of errors) - the error (nil in case of success)
func (Client) FilterProfileAttrs ¶
func (client Client) FilterProfileAttrs(objType string, profile map[string]interface{}, filter []string)
FilterProfileAttrs - filters out profile attributes Workflow:
- as the object can have nested structs, we need to proceed in this way:
- we have the object type
- we get the object schema
- for each schema attr we get:
- the type(s)
- the authentication rules
- the is_array boolean flag
- we also have a global map of schemas for structs in the model package SO:
- for each object attr:
- for each attribute type
- if type is not in global struct map
- delete attribute from profile if not valid
- else (it's a struct, we have hence metadata for it from model...):
- if is_array:
- for each array item (needs to have a pointer to the struct):
- for each attr in item:
- delete from item if not valid
------------------------------------------------------------------------------
func (Client) GetObjectSchema ¶
GetObjectSchema - retrieves the object schmea
func (Client) GetValidKeys ¶
GetValidKeys - retrieves the list of valid keys for the performed operation from the object schema
func (Client) Read ¶
Read - reads an object given its reference id The pointer to the object is passed as input param returns an error (nil in case of success)