label

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package label is to handle label selector for resources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RestCreateOrUpdateLabel

func RestCreateOrUpdateLabel(c echo.Context) error

RestCreateOrUpdateLabel godoc @ID CreateOrUpdateLabel @Summary Create or update a label for a resource @Description Create or update a label for a resource identified by its uid @Tags [Infra Resource] Common Utility @Accept json @Produce json @Param labelType path string true "Label Type" Enums(ns, mci, subGroup, vm, k8s, vNet, subnet, vpn, securityGroup, sshKey, dataDisk, sqlDb, objectStorage) @Param uid path string true "Resource uid" @Param labels body model.Label true "Labels to create or update" @Success 200 {object} model.SimpleMsg "Label created or updated successfully" @Failure 400 {object} model.SimpleMsg "Invalid request" @Failure 500 {object} model.SimpleMsg "Internal Server Error" @Router /label/{labelType}/{uid} [put]

func RestGetLabels

func RestGetLabels(c echo.Context) error

RestGetLabels godoc @ID GetLabels @Summary Get labels for a resource @Description Get labels for a resource identified by its uid @Tags [Infra Resource] Common Utility @Accept json @Produce json @Param labelType path string true "Label Type" Enums(ns, mci, subGroup, vm, k8s, vNet, subnet, vpn, securityGroup, sshKey, dataDisk, sqlDb, objectStorage) @Param uid path string true "Resource uid" @Success 200 {object} model.LabelInfo "Labels for the resource" @Failure 400 {object} model.SimpleMsg "Invalid request" @Failure 500 {object} model.SimpleMsg "Internal Server Error" @Router /label/{labelType}/{uid} [get]

func RestGetResourcesByLabelSelector

func RestGetResourcesByLabelSelector(c echo.Context) error

RestGetResourcesByLabelSelector godoc @ID GetResourcesByLabelSelector @Summary Get resources by label selector @Description Get resources based on a label selector. The label selector supports the following operators: @Description - `=` : Selects resources where the label key equals the specified value (e.g., `env=production`). @Description - `!=` : Selects resources where the label key does not equal the specified value (e.g., `tier!=frontend`). @Description - `in` : Selects resources where the label key is in the specified set of values (e.g., `region in (us-west, us-east)`). @Description - `notin` : Selects resources where the label key is not in the specified set of values (e.g., `env notin (production, staging)`). @Description - `exists` : Selects resources where the label key exists (e.g., `env exists`). @Description - `!exists` : Selects resources where the label key does not exist (e.g., `env !exists`). @Tags [Infra Resource] Common Utility @Accept json @Produce json @Param labelType path string true "Label Type" Enums(ns, mci, subGroup, vm, k8s, vNet, subnet, vpn, securityGroup, sshKey, dataDisk, sqlDb, objectStorage) @Param labelSelector query string true "Label selector query. Example: env=production,tier=backend" @Success 200 {object} ResourcesResponse "Matched resources" @Failure 400 {object} model.SimpleMsg "Invalid request" @Failure 500 {object} model.SimpleMsg "Internal Server Error" @Router /resources/{labelType} [get]

func RestGetSystemLabelInfo added in v0.9.12

func RestGetSystemLabelInfo(c echo.Context) error

RestGetSystemLabelInfo godoc @ID GetSystemLabelInfo @Summary Return LabelTypes and system defined label keys with example @Description Return LabelTypes and system defined label keys with example @Tags [Infra Resource] Common Utility @Accept json @Produce json @Success 200 {object} model.SystemLabelInfo "LabelTypes and System labels with example values" @Failure 500 {object} model.SimpleMsg "Internal Server Error" @Router /labelInfo [get]

func RestRemoveLabel

func RestRemoveLabel(c echo.Context) error

RestRemoveLabel godoc @ID RemoveLabel @Summary Remove a label from a resource @Description Remove a label from a resource identified by its uid @Tags [Infra Resource] Common Utility @Accept json @Produce json @Param labelType path string true "Label Type" Enums(ns, mci, subGroup, vm, k8s, vNet, subnet, vpn, securityGroup, sshKey, dataDisk, sqlDb, objectStorage) @Param uid path string true "Resource uid" @Param key path string true "Label key to remove" @Success 200 {object} model.SimpleMsg "Label removed successfully" @Failure 400 {object} model.SimpleMsg "Invalid request" @Failure 500 {object} model.SimpleMsg "Internal Server Error" @Router /label/{labelType}/{uid}/{key} [delete]

Types

type ResourcesResponse

type ResourcesResponse struct {
	Results []interface{} `json:"results"`
}

ResourcesResponse is a struct to wrap the results of a label selector query

Jump to

Keyboard shortcuts

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