data_controllers

package
v0.0.0-...-dd13c3c Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTENT_TYPE_YANG_DATA_JSON string = "application/yang-data+json"
	CONTENT_TYPE_XRD_XML        string = "application/xrd+xml"
	XRD_NAMESPACE               string = "http://docs.oasis-open.org/ns/xri/xrd-1.0"
)
View Source
const (
	DEFAULT_ACL_LIFETIME_IN_MINUTES = 7 * 1440
)
View Source
const (
	DEFAULT_ALIAS_LIFETIME_IN_MINUTES = 7 * 1440
)

Variables

This section is empty.

Functions

func GetDataAliasesByName

func GetDataAliasesByName(customer *models.Customer, cuid string, aliases []string) (res types.Aliases, err error)

* Validate aliases: have they been created by the client * parameter: * customer request source Customer * cuid client identifier * aliases a list of alias-name * return: * res: a list of alias data corresponding to alias-name * err: Error occur in validation progress

func GetVendorMappingByCuid

func GetVendorMappingByCuid(customer *models.Customer, cuid string) (res *types.VendorMapping, err error)

Get vendor-mapping by cuid

func HandleCallBlockerOrCancelBlocker

func HandleCallBlockerOrCancelBlocker(acl *data_models.ACL, customer *models.Customer, cuid string, oldActivateType types.ActivationType) (errMsg string)

* If ACL status is changed from active to inactive => cancel blocker * If ACL status is changed from inactive to active => call blocker

func HasParam

func HasParam(ps httprouter.Params, name string) bool

func RecheckIpRangeForAcls

func RecheckIpRangeForAcls(customer *models.Customer) (err error)

* Re-check ip-address range for data channel acls by customer id * parameter: * customerId the id of updated customer * return: * err error

func Unmarshal

func Unmarshal(request *http.Request, val interface{}) error

Types

type ACLsController

type ACLsController struct {
}

func (*ACLsController) Delete

func (c *ACLsController) Delete(customer *models.Customer, r *http.Request, p httprouter.Params) (Response, error)

func (*ACLsController) Get

func (*ACLsController) GetAll

func (c *ACLsController) GetAll(customer *models.Customer, r *http.Request, p httprouter.Params) (Response, error)

func (*ACLsController) Put

type AliasesController

type AliasesController struct {
}

func (*AliasesController) Delete

func (c *AliasesController) Delete(customer *models.Customer, r *http.Request, p httprouter.Params) (Response, error)

func (*AliasesController) Get

func (*AliasesController) GetAll

func (c *AliasesController) GetAll(customer *models.Customer, r *http.Request, p httprouter.Params) (Response, error)

func (*AliasesController) Put

type CapabilitiesController

type CapabilitiesController struct {
}

func (*CapabilitiesController) Get

func (c *CapabilitiesController) Get(customer *models.Customer, r *http.Request, p httprouter.Params) (_ Response, err error)

type ClientsController

type ClientsController struct {
}

func (*ClientsController) Delete

func (c *ClientsController) Delete(customer *models.Customer, r *http.Request, p httprouter.Params) (Response, error)

func (*ClientsController) Get

func (*ClientsController) Post

func (*ClientsController) Put

type ErrTag

type ErrTag string
const (
	ErrorTag_In_Use          ErrTag = "in-use"          // 409
	ErrorTag_Lock_Denied     ErrTag = "lock-denied"     // 409
	ErrorTag_Resource_Denied ErrTag = "resource-denied" // 409
	ErrorTag_Data_Exists     ErrTag = "data-exists"     // 409
	ErrorTag_Data_Missing    ErrTag = "data-missing"    // 409

	ErrorTag_Invalid_Value     ErrTag = "invalid-value"      // 400, 404, or 406
	ErrorTag_Response_Too_Big  ErrTag = "(response) too-big" // 400
	ErrorTag_Missing_Attribute ErrTag = "missing-attribute"  // 400
	ErrorTag_Bad_Attribute     ErrTag = "bad-attribute"      // 400
	ErrorTag_Unknown_Attribute ErrTag = "unknown-attribute"  // 400
	ErrorTag_Bad_Element       ErrTag = "bad-element"        // 400
	ErrorTag_Unknown_Element   ErrTag = "unknown-element"    // 400
	ErrorTag_Unknown_Namespace ErrTag = "unknown-namespace"  // 400
	ErrorTag_Malformed_Message ErrTag = "malformed-message"  // 400

	ErrorTag_Access_Denied           ErrTag = "access-denied"           // 401 or 403
	ErrorTag_Operation_Not_Supported ErrTag = "operation-not-supported" // 405 or 501

	ErrorTag_Operation_Failed  ErrTag = "operation-failed"  // 412 or 500
	ErrorTag_Request_Too_Big   ErrTag = "(request) too-big" // 413
	ErrorTag_Rollback_Failed   ErrTag = "rollback-failed"   // 500
	ErrorTag_Partial_Operation ErrTag = "partial-operation" // 500

)

type ErrType

type ErrType string
const (
	ErrorType_Transport   ErrType = "transport"
	ErrorType_RPC         ErrType = "rpc"
	ErrorType_Protocol    ErrType = "protocol"
	ErrorType_Application ErrType = "application"
)

type Error

type Error struct {
	ErrorType    ErrType `yang:"nonconfig" json:"error-type"`
	ErrorTag     ErrTag  `yang:"nonconfig" json:"error-tag"`
	ErrorMessage string  `yang:"nonconfig" json:"error-message"`
}

func (*Error) GetDefaultErrorType

func (e *Error) GetDefaultErrorType() ErrType

type Errors

type Errors struct {
	Error []Error `json:"error"`
}

type ErrorsResponse

type ErrorsResponse struct {
	Errors Errors `json:"ietf-restconf:errors"`
}
type Link struct {
	Rel  string `xml:"rel,attr"`
	Href string `xml:"href,attr"`
}

type PostController

type PostController struct {
}

func (*PostController) Post

func (c *PostController) Post(customer *models.Customer, r *http.Request, p httprouter.Params) (Response, error)

type ResourceDiscoveryController

type ResourceDiscoveryController struct {
}

func (*ResourceDiscoveryController) Get

type Response

type Response struct {
	Code    int
	Headers http.Header
	Content []byte
}

func EmptyResponse

func EmptyResponse(code int) (Response, error)

func ErrorResponse

func ErrorResponse(errorCode int, errorTag ErrTag, errorMsg string, isAfterTransaction bool) (Response, error)

func UpdateACLActivationType

func UpdateACLActivationType(customer *models.Customer, cuid string, controlFilteringList []models.ControlFiltering) (res Response, err error)

* Handle Signal Channel Control Filtering: Update activation type for ACLs * parameter: * customer the client * cuid the id of the client * controlFilteringList list of acl control filtering * return: * res the response * err error

func WithClient

func WithClient(tx *db.Tx, customer *models.Customer, cuid string, f func(*data_models.Client) (Response, error)) (Response, error)

func WithTransaction

func WithTransaction(f func(*db.Tx) (Response, error)) (Response, error)

func YangJsonResponse

func YangJsonResponse(content interface{}) (Response, error)

type VendorMappingController

type VendorMappingController struct{}

func (*VendorMappingController) DeleteAll

Delete all vendor-mapping

func (*VendorMappingController) DeleteOne

Delete one vendor-mapping

func (*VendorMappingController) Get

Get vendor-mapping

func (*VendorMappingController) GetVendorMappingOfServer

func (v *VendorMappingController) GetVendorMappingOfServer(customer *models.Customer, r *http.Request, p httprouter.Params) (Response, error)

Get vendor-mapping of sever

func (*VendorMappingController) Put

Put vendor-mapping

type XRD

type XRD struct {
	Xmlns string `xml:"xmlns,attr"`
	Link  []Link
}

Jump to

Keyboard shortcuts

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