217 lines
6.6 KiB
Go
217 lines
6.6 KiB
Go
package profitbricks
|
|
|
|
// slash returns "/<str>" great for making url paths
|
|
func slash(str string) string {
|
|
return "/" + str
|
|
}
|
|
|
|
// dc_col_path returns the string "/datacenters"
|
|
func dc_col_path() string {
|
|
return slash("datacenters")
|
|
}
|
|
|
|
// dc_path returns the string "/datacenters/<dcid>"
|
|
func dc_path(dcid string) string {
|
|
return dc_col_path() + slash(dcid)
|
|
}
|
|
|
|
// image_col_path returns the string" /images"
|
|
func image_col_path() string {
|
|
return slash("images")
|
|
}
|
|
|
|
// image_path returns the string"/images/<imageid>"
|
|
func image_path(imageid string) string {
|
|
return image_col_path() + slash(imageid)
|
|
}
|
|
|
|
// ipblock_col_path returns the string "/ipblocks"
|
|
func ipblock_col_path() string {
|
|
return slash("ipblocks")
|
|
}
|
|
|
|
// ipblock_path returns the string "/ipblocks/<ipblockid>"
|
|
func ipblock_path(ipblockid string) string {
|
|
return ipblock_col_path() + slash(ipblockid)
|
|
}
|
|
|
|
// location_col_path returns the string "/locations"
|
|
func location_col_path() string {
|
|
return slash("locations")
|
|
}
|
|
|
|
// location_path returns the string "/locations/<locid>"
|
|
func location_path(locid string) string {
|
|
return location_col_path() + slash(locid)
|
|
}
|
|
|
|
// location_path returns the string "/locations/<regid>"
|
|
func location_reg_path(regid string) string {
|
|
return location_col_path() + slash(regid)
|
|
}
|
|
|
|
// snapshot_col_path returns the string "/snapshots"
|
|
func snapshot_col_path() string {
|
|
return slash("snapshots")
|
|
}
|
|
|
|
// lan_col_path returns the string "/datacenters/<dcid>/lans"
|
|
func lan_col_path(dcid string) string {
|
|
return dc_path(dcid) + slash("lans")
|
|
}
|
|
|
|
// lan_path returns the string "/datacenters/<dcid>/lans/<lanid>"
|
|
func lan_path(dcid, lanid string) string {
|
|
return lan_col_path(dcid) + slash(lanid)
|
|
}
|
|
|
|
// lbal_col_path returns the string "/loadbalancers"
|
|
func lbal_col_path(dcid string) string {
|
|
return dc_path(dcid) + slash("loadbalancers")
|
|
}
|
|
|
|
// lbalpath returns the string "/loadbalancers/<lbalid>"
|
|
func lbal_path(dcid, lbalid string) string {
|
|
return lbal_col_path(dcid) + slash(lbalid)
|
|
}
|
|
|
|
// server_col_path returns the string "/datacenters/<dcid>/servers"
|
|
func server_col_path(dcid string) string {
|
|
return dc_path(dcid) + slash("servers")
|
|
}
|
|
|
|
// server_path returns the string "/datacenters/<dcid>/servers/<srvid>"
|
|
func server_path(dcid, srvid string) string {
|
|
return server_col_path(dcid) + slash(srvid)
|
|
}
|
|
|
|
// server_cmd_path returns the string "/datacenters/<dcid>/servers/<srvid>/<cmd>"
|
|
func server_command_path(dcid, srvid, cmd string) string {
|
|
return server_path(dcid, srvid) + slash(cmd)
|
|
}
|
|
|
|
// volume_col_path returns the string "/volumes"
|
|
func volume_col_path(dcid string) string {
|
|
return dc_path(dcid) + slash("volumes")
|
|
}
|
|
|
|
// volume_path returns the string "/volumes/<volid>"
|
|
func volume_path(dcid, volid string) string {
|
|
return volume_col_path(dcid) + slash(volid)
|
|
}
|
|
|
|
// balnic_col_path returns the string "/loadbalancers/<lbalid>/balancednics"
|
|
func balnic_col_path(dcid, lbalid string) string {
|
|
return lbal_path(dcid, lbalid) + slash("balancednics")
|
|
}
|
|
|
|
// balnic_path returns the string "/loadbalancers/<lbalid>/balancednics<balnicid>"
|
|
func balnic_path(dcid, lbalid, balnicid string) string {
|
|
return balnic_col_path(dcid, lbalid) + slash(balnicid)
|
|
}
|
|
|
|
// server_cdrom_col_path returns the string "/datacenters/<dcid>/servers/<srvid>/cdroms"
|
|
func server_cdrom_col_path(dcid, srvid string) string {
|
|
return server_path(dcid, srvid) + slash("cdroms")
|
|
}
|
|
|
|
// server_cdrom_path returns the string "/datacenters/<dcid>/servers/<srvid>/cdroms/<cdid>"
|
|
func server_cdrom_path(dcid, srvid, cdid string) string {
|
|
return server_cdrom_col_path(dcid, srvid) + slash(cdid)
|
|
}
|
|
|
|
// server_volume_col_path returns the string "/datacenters/<dcid>/servers/<srvid>/volumes"
|
|
func server_volume_col_path(dcid, srvid string) string {
|
|
return server_path(dcid, srvid) + slash("volumes")
|
|
}
|
|
|
|
// server_volume_path returns the string "/datacenters/<dcid>/servers/<srvid>/volumes/<volid>"
|
|
func server_volume_path(dcid, srvid, volid string) string {
|
|
return server_volume_col_path(dcid, srvid) + slash(volid)
|
|
}
|
|
|
|
// nic_path returns the string "/datacenters/<dcid>/servers/<srvid>/nics"
|
|
func nic_col_path(dcid, srvid string) string {
|
|
return server_path(dcid, srvid) + slash("nics")
|
|
}
|
|
|
|
// nic_path returns the string "/datacenters/<dcid>/servers/<srvid>/nics/<nicid>"
|
|
func nic_path(dcid, srvid, nicid string) string {
|
|
return nic_col_path(dcid, srvid) + slash(nicid)
|
|
}
|
|
|
|
// fwrule_col_path returns the string "/datacenters/<dcid>/servers/<srvid>/nics/<nicid>/firewallrules"
|
|
func fwrule_col_path(dcid, srvid, nicid string) string {
|
|
return nic_path(dcid, srvid, nicid) + slash("firewallrules")
|
|
}
|
|
|
|
// fwrule_path returns the string
|
|
// "/datacenters/<dcid>/servers/<srvid>/nics/<nicid>/firewallrules/<fwruleid>"
|
|
func fwrule_path(dcid, srvid, nicid, fwruleid string) string {
|
|
return fwrule_col_path(dcid, srvid, nicid) + slash(fwruleid)
|
|
}
|
|
|
|
// contract_resource_path returns the string "/contracts"
|
|
func contract_resource_path() string {
|
|
return slash("contracts")
|
|
}
|
|
|
|
func um() string {
|
|
return slash("um")
|
|
}
|
|
|
|
// um_groups returns the string "/groups"
|
|
func um_groups() string {
|
|
return um() + slash("groups")
|
|
}
|
|
|
|
// um_group_path returns the string "/groups/groupid"
|
|
func um_group_path(grpid string) string {
|
|
return um_groups() + slash(grpid)
|
|
}
|
|
|
|
// um_group_shares returns the string "groups/{groupId}/shares"
|
|
func um_group_shares(grpid string) string {
|
|
return um() + slash("groups") + slash(grpid) + slash("shares")
|
|
}
|
|
|
|
// um_group_share_path returns the string "groups/{groupId}/shares/{resourceId}"
|
|
func um_group_share_path(grpid string, resourceid string) string {
|
|
return um() + slash("groups") + slash(grpid) + slash("shares") + slash(resourceid)
|
|
}
|
|
|
|
// um_group_users returns the string "/groups/groupid/users"
|
|
func um_group_users(grpid string) string {
|
|
return um() + slash("groups") + slash(grpid) + slash("users")
|
|
}
|
|
|
|
// um_group_users_path returns the string "/groups/groupid/users/userid"
|
|
func um_group_users_path(grpid string, usrid string) string {
|
|
return um() + slash("groups") + slash(grpid) + slash("users") + slash(usrid)
|
|
}
|
|
|
|
// um_users returns the string "/users"
|
|
func um_users() string {
|
|
return um() + slash("users")
|
|
}
|
|
|
|
// um_users returns the string "/users/usrid"
|
|
func um_users_path(usrid string) string {
|
|
return um() + slash("users") + slash(usrid)
|
|
}
|
|
|
|
// um_resources returns the string "/resources"
|
|
func um_resources() string {
|
|
return um() + slash("resources")
|
|
}
|
|
|
|
// um_resources_type returns the string "/resources/resourceType"
|
|
func um_resources_type(restype string) string {
|
|
return um() + slash("resources") + slash(restype)
|
|
}
|
|
|
|
// um_resources_type_path returns the string "resources/{resourceType}/{resourceId}"
|
|
func um_resources_type_path(restype string, resourceid string) string {
|
|
return um() + slash("resources") + slash(restype) + slash(resourceid)
|
|
}
|