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 CheckIfCurrentUserCanModifyCDN(tx *sql.Tx, cdn, user string) (error, error, int)
- func CheckIfCurrentUserCanModifyCDNWithID(tx *sql.Tx, cdnID int64, user string) (error, error, int)
- func CheckIfCurrentUserCanModifyCDNs(tx *sql.Tx, cdns []string, user string) (error, error, int)
- func CheckIfCurrentUserCanModifyCDNsByID(tx *sql.Tx, cdns []int, user string) (error, error, int)
- func CheckIfCurrentUserCanModifyCachegroup(tx *sql.Tx, cachegroupID int, user string) (error, error, int)
- func CheckIfCurrentUserCanModifyCachegroups(tx *sql.Tx, cachegroupIDs []int, user string) (error, error, int)
- func CheckIfCurrentUserHasCdnLock(tx *sql.Tx, cdn, user string) (error, error, int)
- func CheckOriginServerInDSCG(tx *sql.Tx, dsID int, dsTopology string) (error, error, int)
- func CheckTopology(tx *sqlx.Tx, ds tc.DeliveryServiceV4) (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 DSRExistsWithXMLID(xmlid string, tx *sql.Tx) (bool, error)
- func GetCDNDSes(tx *sql.Tx, cdn tc.CDNName) (map[string]struct{}, error)
- func GetCDNDomainFromName(tx *sql.Tx, cdnName tc.CDNName) (string, bool, error)
- func GetCDNIDFromFedID(id int, tx *sql.Tx) (int, bool, error)
- func GetCDNIDFromName(tx *sql.Tx, name tc.CDNName) (int, bool, error)
- func GetCDNIDsFromFedResolverID(id int, tx *sql.Tx) ([]int, bool, error)
- func GetCDNNameDomain(cdnID int, tx *sql.Tx) (string, string, error)
- func GetCDNNameFromDSXMLID(tx *sql.Tx, dsXMLID string) (string, error)
- func GetCDNNameFromID(tx *sql.Tx, id int64) (tc.CDNName, bool, error)
- func GetCDNNameFromProfileID(tx *sql.Tx, id int) (tc.CDNName, error)
- func GetCDNNameFromProfileName(tx *sql.Tx, profileName string) (tc.CDNName, error)
- func GetCDNNameFromServerID(tx *sql.Tx, serverId int64) (tc.CDNName, error)
- func GetCDNNamesFromDSIds(tx *sql.Tx, dsIds []int) ([]string, error)
- func GetCDNNamesFromProfileIDs(tx *sql.Tx, profileIDs []int64) ([]string, error)
- func GetCDNNamesFromServerIds(tx *sql.Tx, serverIds []int64) ([]string, 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 GetDSIDFromStaticDNSEntry(tx *sql.Tx, staticDNSEntryID int) (int, 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 GetDeliveryServiceTypeAndCDNName(dsID int, tx *sql.Tx) (tc.DSType, string, 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 GetRequiredCapabilitiesOfDeliveryServices(ids []int, tx *sql.Tx) (map[int][]string, error)
- func GetServerCapabilitiesFromName(name string, tx *sql.Tx) ([]string, error)
- func GetServerCapabilitiesOfServers(names []string, tx *sql.Tx) (map[string][]string, error)
- func GetServerIDFromName(serverName string, tx *sql.Tx) (int, bool, error)
- func GetServerIDsFromCachegroupNames(tx *sql.Tx, cgID []string) ([]int64, 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.ServerInterfaceInfoV40, 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 CheckIfCurrentUserCanModifyCDN ¶
CheckIfCurrentUserCanModifyCDN checks if the current user has the lock on the cdn that the requested operation is to be performed on. This will succeed if the either there is no lock by any user on the CDN, or if the current user has the lock on the CDN.
func CheckIfCurrentUserCanModifyCDNWithID ¶
CheckIfCurrentUserCanModifyCDNWithID checks if the current user has the lock on the cdn (identified by ID) that the requested operation is to be performed on. This will succeed if the either there is no lock by any user on the CDN, or if the current user has the lock on the CDN.
func CheckIfCurrentUserCanModifyCDNs ¶
CheckIfCurrentUserCanModifyCDNs checks if the current user has the lock on the list of cdns that the requested operation is to be performed on. This will succeed if the either there is no lock by any user on any of the CDNs, or if the current user has the lock on any of the CDNs.
func CheckIfCurrentUserCanModifyCDNsByID ¶
CheckIfCurrentUserCanModifyCDNs checks if the current user has the lock on the list of cdns(identified by ID) that the requested operation is to be performed on. This will succeed if the either there is no lock by any user on any of the CDNs, or if the current user has the lock on any of the CDNs.
func CheckIfCurrentUserCanModifyCachegroup ¶
func CheckIfCurrentUserCanModifyCachegroup(tx *sql.Tx, cachegroupID int, user string) (error, error, int)
CheckIfCurrentUserCanModifyCachegroup checks if the current user has the lock on the cdns that are associated with the provided cachegroup ID. This will succeed if no other user has a hard lock on any of the CDNs that relate to the cachegroup in question.
func CheckIfCurrentUserCanModifyCachegroups ¶
func CheckIfCurrentUserCanModifyCachegroups(tx *sql.Tx, cachegroupIDs []int, user string) (error, error, int)
CheckIfCurrentUserCanModifyCachegroups checks if the current user has the lock on the cdns that are associated with the provided cachegroup IDs. This will succeed if no other user has a hard lock on any of the CDNs that relate to the cachegroups in question.
func CheckIfCurrentUserHasCdnLock ¶
CheckIfCurrentUserHasCdnLock checks if the current user has the lock on the cdn that the requested operation is to be performed on. This will succeed if the either there is no lock by any user on the CDN, or if the current user has the lock on the CDN.
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. Note that this can panic if ds does not have a properly set CDNID.
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 DSRExistsWithXMLID ¶
DSRExistsWithXMLID returns whether or not an **open** Delivery Service Request with the given xmlid exists, and any error that occurred.
func GetCDNDomainFromName ¶
GetCDNDomainFromName returns the domain, whether the cdn exists, and any error.
func GetCDNIDFromFedID ¶
GetCDNIDFromFedID returns the ID of the CDN for the current federation.
func GetCDNIDFromName ¶
GetCDNIDFromName returns the ID of the CDN if a CDN with the name exists
func GetCDNIDsFromFedResolverID ¶
GetCDNIDFromFedResolverID returns the IDs of the CDNs that the fed resolver is associated with.
func GetCDNNameDomain ¶
GetCDNNameDomain returns the name and domain for a given CDN ID.
func GetCDNNameFromDSXMLID ¶
GetCDNNameFromDSXMLID returns the CDN name of the DS associated with the supplied XML ID
func GetCDNNameFromProfileID ¶
GetCDNNameFromProfileID returns the cdn name for the provided profile ID.
func GetCDNNameFromProfileName ¶
GetCDNNameFromProfileName returns the cdn name for the provided profile name.
func GetCDNNameFromServerID ¶
GetCDNNameFromServerID gets the CDN name for the server with the given ID.
func GetCDNNamesFromDSIds ¶
GetCDNNamesFromDSIds returns a list of cdn names for a list of DS IDs.
func GetCDNNamesFromProfileIDs ¶
GetCDNNamesFromProfileIDs returns a list of cdn names for a list of profile IDs.
func GetCDNNamesFromServerIds ¶
GetCDNNamesFromServerIds returns a list of cdn names for a list of server IDs.
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 GetDSIDFromStaticDNSEntry ¶
GetDSIDFromStaticDNSEntry returns the delivery service ID associated with the static DNS entry
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 GetDeliveryServiceTypeAndCDNName ¶
GetDeliveryServiceTypeAndCDNName returns the type and the CDN name 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 GetRequiredCapabilitiesOfDeliveryServices ¶
GetRequiredCapabilitiesOfDeliveryServices gets all of the required capabilities of the given delivery service IDs.
func GetServerCapabilitiesFromName ¶
GetServerCapabilitiesFromName returns the server's capabilities.
func GetServerCapabilitiesOfServers ¶
GetServerCapabilitiesOfServers gets all of the server capabilities of the given server hostnames.
func GetServerIDFromName ¶
GetServerIDFromName gets server id from a given name
func GetServerIDsFromCachegroupNames ¶
GetServerIDsFromCachegroupNames returns a list of servers IDs for a list of cachegroup IDs.
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 ¶
func GetServersInterfaces(ids []int, tx *sql.Tx) (map[int]map[string]tc.ServerInterfaceInfoV40, error)
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.