Documentation ¶
Index ¶
- Constants
- func AddTenancyCheck(where string, queryValues map[string]interface{}, tenantColumnName string, ...) (string, map[string]interface{})
- func BuildWhereAndOrderByAndPagination(parameters map[string]string, queryParamsToSQLCols map[string]WhereColumnInfo) (string, string, string, map[string]interface{}, []error)
- func CDNExists(cdnName string, tx *sql.Tx) (bool, error)
- func CachegroupHasTopologyBasedDeliveryServicesOnCDN(tx *sql.Tx, cachegroupID int, CDNID int) (bool, error)
- func CachegroupParameterAssociationExists(id int, cachegroup int, tx *sql.Tx) (bool, error)
- func CheckOriginServerInDSCG(tx *sql.Tx, dsID int, dsTopology string) (error, error, int)
- func CheckTopology(tx *sqlx.Tx, ds tc.DeliveryServiceNullableV30) (int, error, error)
- func CheckTopologyOrgServerCGInDSCG(tx *sql.Tx, cdnIds []int, dsTopology string, topologyCGNames []string) (error, error, int)
- func CommitIf(tx *sql.Tx, doCommit *bool)
- func GetCDNDSes(tx *sql.Tx, cdn tc.CDNName) (map[tc.DeliveryServiceName]struct{}, error)
- func GetCDNDomainFromName(tx *sql.Tx, cdnName tc.CDNName) (string, bool, error)
- func GetCDNIDFromName(tx *sql.Tx, name tc.CDNName) (int, bool, error)
- func GetCDNNameFromID(tx *sql.Tx, id int64) (tc.CDNName, bool, error)
- func GetCDNs(tx *sql.Tx) (map[tc.CDNName]struct{}, error)
- func GetCacheGroupNameFromID(tx *sql.Tx, id int) (tc.CacheGroupName, bool, error)
- func GetDSCDNIdFromID(tx *sql.Tx, dsID int) (int, bool, error)
- func GetDSIDAndCDNFromName(tx *sql.Tx, xmlID string) (int, tc.CDNName, bool, error)
- func GetDSNameAndCDNFromID(tx *sql.Tx, id int) (tc.DeliveryServiceName, tc.CDNName, bool, error)
- func GetDSNameFromID(tx *sql.Tx, id int) (tc.DeliveryServiceName, bool, error)
- func GetDSRequiredCapabilitiesFromID(id int, tx *sql.Tx) ([]string, error)
- func GetDSTenantIDFromXMLID(tx *sql.Tx, xmlid string) (int, bool, error)
- func GetDeliveryServiceCDNsByTopology(tx *sql.Tx, topology string) ([]int, error)
- func GetDeliveryServiceType(dsID int, tx *sql.Tx) (tc.DSType, bool, error)
- func GetDeliveryServiceTypeRequiredCapabilitiesAndTopology(dsID int, tx *sql.Tx) (tc.DSType, []string, *string, bool, error)
- func GetDeliveryServicesWithTopologies(tx *sql.Tx, dsIDs []int) ([]int, error)
- func GetFederationIDForUserIDByXMLID(tx *sql.Tx, userID int, xmlid string) (uint, bool, error)
- func GetFederationNameFromID(id int, tx *sql.Tx) (string, bool, error)
- func GetFederationResolversByFederationID(tx *sql.Tx, fedID int) ([]tc.FederationResolver, error)
- func GetGlobalParam(tx *sql.Tx, name string) (string, bool, error)
- func GetParam(tx *sql.Tx, name string, configFile string) (string, bool, error)
- func GetParamNameByID(tx *sql.Tx, id int) (string, bool, error)
- func GetPrivLevelFromRoleID(tx *sql.Tx, id int) (int, bool, error)
- func GetProfileIDFromName(name string, tx *sql.Tx) (int, bool, error)
- func GetProfileNameFromID(id int, tx *sql.Tx) (string, bool, error)
- func GetServerCapabilitiesFromName(name string, tx *sql.Tx) ([]string, error)
- func GetServerIDFromName(serverName string, tx *sql.Tx) (int, bool, error)
- func GetServerInfo(serverID int, tx *sql.Tx) (tc.ServerInfo, bool, error)
- func GetServerInfosFromHostNames(tx *sql.Tx, hostNames []string) ([]tc.ServerInfo, error)
- func GetServerInfosFromIDs(tx *sql.Tx, ids []int) ([]tc.ServerInfo, error)
- func GetServerNameFromID(tx *sql.Tx, id int) (string, bool, error)
- func GetServersInterfaces(ids []int, tx *sql.Tx) (map[int]map[string]tc.ServerInterfaceInfo, error)
- func GetStatusByID(id int, tx *sql.Tx) (tc.StatusNullable, bool, error)
- func GetStatusByName(name string, tx *sql.Tx) (tc.StatusNullable, bool, error)
- func GetTopologyCachegroups(tx *sql.Tx, name string) ([]int, []string, error)
- func GetTypeIDByName(t string, tx *sql.Tx) (int, bool, error)
- func GetUserByEmail(email string, tx *sql.Tx) (tc.User, bool, error)
- func GetUserByID(id int, tx *sql.Tx) (tc.User, bool, error)
- func ScanCachegroupsServerCapabilities(rows *sql.Rows) (map[string][]int, map[int]map[string]struct{}, map[int]int, error)
- func TopologyExists(tx *sql.Tx, name string) (bool, error)
- func UsernameExists(uname string, tx *sql.Tx) (bool, error)
- type WhereColumnInfo
Constants ¶
const BaseLimit = "\nLIMIT"
const BaseOffset = "\nOFFSET"
const BaseOrderBy = "\nORDER BY"
const BaseWhere = "\nWHERE"
Variables ¶
This section is empty.
Functions ¶
func AddTenancyCheck ¶
func AddTenancyCheck(where string, queryValues map[string]interface{}, tenantColumnName string, tenantIDs []int) (string, map[string]interface{})
AddTenancyCheck takes a WHERE clause (can be ""), the associated queryValues (can be empty), a tenantColumnName that should provide a bigint corresponding to the tenantID of the object being checked (this may require a CAST), and an array of the tenantIDs the user has access to; it returns a where clause and associated queryValues including filtering based on tenancy.
func CachegroupHasTopologyBasedDeliveryServicesOnCDN ¶
func CachegroupHasTopologyBasedDeliveryServicesOnCDN(tx *sql.Tx, cachegroupID int, CDNID int) (bool, error)
CheckCachegroupHasTopologyBasedDeliveryServicesOnCDN returns true if the given cachegroup is assigned to any topologies with delivery services assigned on the given CDN.
func CachegroupParameterAssociationExists ¶
CachegroupParameterAssociationExists returns whether a cachegroup parameter association with the given parameter id exists, and any error.
func CheckOriginServerInDSCG ¶
CheckOriginServerInDSCG checks if a DS has ORG server and if it does, to make sure the cachegroup is part of DS
func CheckTopology ¶
CheckTopology returns an error if the given Topology does not exist or if one of the Topology's Cache Groups is empty with respect to the Delivery Service's CDN.
func CheckTopologyOrgServerCGInDSCG ¶
func CheckTopologyOrgServerCGInDSCG(tx *sql.Tx, cdnIds []int, dsTopology string, topologyCGNames []string) (error, error, int)
CheckTopologyOrgServerCGInDSCG checks if ORG server are part of DS. IF they are then the user is not allowed to remove the ORG servers from the associated DS's topology
func CommitIf ¶
CommitIf commits if doCommit is true at the time of execution. This is designed as a defer helper.
Example:
tx, err := db.Begin() txCommit := false defer dbhelpers.CommitIf(tx, &txCommit) if err := tx.Exec("select ..."); err != nil { return errors.New("executing: " + err.Error()) } txCommit = true return nil
func GetCDNDSes ¶
func GetCDNDomainFromName ¶
GetCDNDomainFromName returns the domain, whether the cdn exists, and any error.
func GetCDNIDFromName ¶
GetCDNIDFromName returns the ID of the CDN if a CDN with the name exists
func GetCacheGroupNameFromID ¶
GetCacheGroupNameFromID Get Cache Group name from a given ID
func GetDSCDNIdFromID ¶
GetDSCDNIdFromID loads the DeliveryService's cdn ID from the database, from the delivery service ID. Returns whether the delivery service was found, and any error.
func GetDSIDAndCDNFromName ¶
GetDSIDAndCDNFromName returns the delivery service ID and cdn name given from the delivery service name, whether a result existed, and any error.
func GetDSNameAndCDNFromID ¶
returns returns the delivery service name and cdn, whether it existed, and any error.
func GetDSNameFromID ¶
GetDSNameFromID loads the DeliveryService's xml_id from the database, from the ID. Returns whether the delivery service was found, and any error.
func GetDSRequiredCapabilitiesFromID ¶
GetDSRequiredCapabilitiesFromID returns the server's capabilities.
func GetDSTenantIDFromXMLID ¶
GetDSTenantIDFromXMLID fetches the ID of the Tenant to whom the Delivery Service identified by the the provided XMLID belongs. It returns, in order, the requested ID (if one could be found), a boolean indicating whether or not a Delivery Service with the provided xmlid could be found, and an error for logging in case something unexpected goes wrong.
func GetDeliveryServiceCDNsByTopology ¶
GetDeliveryServiceCDNsByTopology returns a slice of CDN IDs for all delivery services assigned to the given topology.
func GetDeliveryServiceType ¶
GetDeliveryServiceType returns the type of the deliveryservice.
func GetDeliveryServiceTypeRequiredCapabilitiesAndTopology ¶
func GetDeliveryServiceTypeRequiredCapabilitiesAndTopology(dsID int, tx *sql.Tx) (tc.DSType, []string, *string, bool, error)
GetDeliveryServiceTypeAndTopology returns the type of the deliveryservice and the name of its topology.
func GetDeliveryServicesWithTopologies ¶
GetDeliveryServicesWithTopologies returns a list containing the delivery services in the given dsIDs list that have a topology assigned. An error indicates unexpected errors that occurred when querying.
func GetFederationIDForUserIDByXMLID ¶
GetFederationIDForUserIDByXMLID retrieves the ID of the Federation assigned to the user defined by userID on the Delivery Service identified by xmlid. If no such federation exists, the boolean returned will be 'false', while the error indicates unexpected errors that occurred when querying.
func GetFederationNameFromID ¶
GetFederationNameFromID returns the federation's name, whether a federation with ID exists, or any error.
func GetFederationResolversByFederationID ¶
GetFederationResolversByFederationID fetches all of the federation resolvers currently assigned to a federation. In the event of an error, it will return an empty slice and the error.
func GetGlobalParam ¶
GetGlobalParams returns the value of the global param, whether it existed, or any error
func GetParamNameByID ¶
GetParamNameByID returns the name of the param, whether it existed, or any error.
func GetPrivLevelFromRoleID ¶
GetPrivLevelFromRoleID returns the priv_level associated with a role, whether it exists, and any error. This method exists on a temporary basis. After priv_level is fully deprecated and capabilities take over, this method will not only no longer be needed, but the corresponding new privilege check should be done via the primary database query for the users endpoint. The users json response will contain a list of capabilities in the future, whereas now the users json response currently does not contain privLevel. See the wiki page on the roles/capabilities as a system: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=68715910
func GetProfileIDFromName ¶
GetProfileIDFromName returns the profile's ID, whether a profile with name exists, or any error.
func GetProfileNameFromID ¶
GetProfileNameFromID returns the profile's name, whether a profile with ID exists, or any error.
func GetServerCapabilitiesFromName ¶
GetServerCapabilitiesFromName returns the server's capabilities.
func GetServerIDFromName ¶
GetServerIDFromName gets server id from a given name
func GetServerInfo ¶
GetServerInfo returns a ServerInfo struct, whether the server exists, and an error (if one occurs).
func GetServerInfosFromHostNames ¶
GetServerInfosFromHostNames returns the ServerInfo structs of the given server host names or an error if any occur.
func GetServerInfosFromIDs ¶
GetServerInfosFromIDs returns the ServerInfo structs of the given server IDs or an error if any occur.
func GetServersInterfaces ¶
GetServerInterfaces, given the IDs of one or more servers, returns all of their network interfaces mapped by their ids, or an error if one occurs during retrieval.
func GetStatusByID ¶
GetStatusByID returns a Status struct, a bool for whether or not a status of the given ID exists, and an error (if one occurs).
func GetStatusByName ¶
GetStatusByName returns a Status struct, a bool for whether or not a status of the given name exists, and an error (if one occurs).
func GetTopologyCachegroups ¶
GetTopologyCachegroups returns an array of cachegroup IDs and an array of cachegroup names for the given topology, or any error.
func GetTypeIDByName ¶
GetTypeIDByName reports the id of the type and whether or not a type exists with the given name.
func GetUserByEmail ¶
GetUserByEmail retrieves the user with the given email. If no such user exists, the boolean returned will be 'false', while the error indicates unexpected errors that occurred when querying.
func GetUserByID ¶
GetUserByID returns the user with the requested ID if one exists. The second return value is a boolean indicating whether said user actually did exist, and the third contains any error encountered along the way.
func ScanCachegroupsServerCapabilities ¶
func ScanCachegroupsServerCapabilities(rows *sql.Rows) (map[string][]int, map[int]map[string]struct{}, map[int]int, error)
ScanCachegroupsServerCapabilities, given rows of (server ID, CDN ID, cachegroup name, server capabilities), returns a map of cachegroup names to server IDs, a map of server IDs to a map of their capabilities, a map of server IDs to CDN IDs, and an error (if one occurs).
func TopologyExists ¶
TopologyExists checks if a Topology with the given name exists. Returns whether or not the Topology exists, along with any encountered error.
func UsernameExists ¶
UsernameExists reports whether or not the the given username exists as a user in the database to which the passed transaction refers. If anything goes wrong when checking the existence of said user, the error is directly returned to the caller. Note that in that case, no real meaning should be assigned to the returned boolean value.