package
0.0.0-20250127091923-25e191d3f2f0
Repository: https://github.com/gosimplicity/ai-cloudops.git
Documentation: pkg.go.dev

# Functions

AesDecrypt AES解密.
AesEncrypt AES加密.
ApiData 通用的返回函数,用于标准化API响应格式 参数: - c: gin 上下文 - code: 状态码 - data: 返回的数据 - message: 返回的消息.
ApplyLimitRange 应用 LimitRange 到指定命名空间.
ApplyResourceQuota 应用 ResourceQuota 到指定命名空间.
ApplyTerraform 执行 Terraform Apply 在指定 Terraform 实例.
BadRequest 参数错误的返回,使用HTTP 400状态码.
BadRequestError 参数错误的失败返回.
BadRequestWithDetails 带详细数据和消息的参数错误返回.
Base64Decode 将 base64 编码的字符串转换为字节数组.
Base64Decrypt 用于解密加密后的密码.
Base64Encode 将字节数组转换为 base64 编码的字符串.
Base64Encrypt 用于加密明文密码.
BuildK8sContainers 构建 K8sContainer 列表.
BuildK8sContainersWithPointer 转换普通切片为指针切片.
No description provided by the author
BuildK8sPods BuildK8sNodes 构建 K8sNode 列表.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
CloneMap 克隆一个字符串到字符串的映射.
No description provided by the author
DaysBetween 计算两个日期之间的天数.
DeepCopyScrapeConfig 深度拷贝 ScrapeConfig.
No description provided by the author
DestroyTerraform 执行 Terraform Destroy 在指定目录.
EnsureDir 确保目录存在,不存在则创建.
EnsureNamespace 确保指定的命名空间存在,如果不存在则创建.
Error 操作失败的返回.
ErrorWithDetails 带详细数据和消息的操作失败返回.
ErrorWithMessage 带消息的操作失败返回.
ExtractIPs 从 Terraform 状态中提取公网和私网 IP.
Forbidden 无权限的返回,使用HTTP 403状态码.
ForbiddenError 无权限的失败返回.
FormatMap 将 map[string]string 格式化为字符串,每个键值对占一行.
No description provided by the author
GenPromDuration 转换秒为Prometheus Duration.
GetDaemonSetResources 获取 DaemonSet 资源.
GetDefaultValue 返回值的默认值(零值).
GetDeploymentResources 获取 Deployment 资源.
No description provided by the author
GetInternalIP 获取节点内部IP.
No description provided by the author
GetKubeClient 获取 Kubernetes 客户端.
GetMax 返回两个数值中的最大值,支持 int, float64 等常见类型.
GetMin 返回两个数值中的最小值,支持 int, float64 等常见类型.
GetNodeAge 计算节点存在时间.
GetNodeEvents 获取节点事件.
GetNodeLabels 获取节点标签.
GetNodeResource 获取节点资源信息.
GetNodeRoles 获取节点角色.
GetNodesByName 获取指定集群上的 Node 列表.
GetNodeStatus 获取节点状态.
GetParamID 从查询参数中解析 ID,并进行类型转换.
GetParamName 从查询参数中解析 Name,并进行类型转换.
GetPodResources 获取 Pod 资源.
GetPodsByNodeName 获取指定节点上的 Pod 列表.
GetQueryID 从query参数中解析 ID,并进行类型转换.
GetReplicaSetResources 获取 ReplicaSet 资源.
GetResourceName 根据 Kind 获取资源名称.
GetResourceString 获取节点资源信息.
GetServiceResources 获取 Service 资源.
GetStatefulSetResources 获取 StatefulSet 资源.
GetTaintsMapFromTaints 将 taints 转换为键为 "Key:Value:Effect" 的 map.
GetTerraformState 获取并解析 Terraform 状态.
HandleRequest 用于统一处理请求绑定和响应.
No description provided by the author
InternalServerError 服务器内部错误的返回,使用HTTP 500状态码.
InternalServerErrorWithDetails 带详细数据和消息的服务器内部错误返回.
IsNodeSchedulable 判断节点是否可调度.
IsSameDay 判断两个日期是否为同一天.
IsType 判断两个值是否是相同类型.
IsValidEmail 简单检查一个字符串是否是有效的电子邮件格式.
MapToStringSlice 将 map 转换为 []string,要求偶数个元素,key和值依次排列.
MergeTaints 合并新的 taints,避免重复.
No description provided by the author
ParseConfigs 解析 Terraform 配置中的各部分.
ParseExternalLabels 解析外部标签.
ParseTags 将 ECS 的 Tags 切片解析为 Prometheus 的标签映射.
ParseURL 解析字符串为URL,返回错误而非 panic.
Ping 检查指定的 IP 地址是否可达.
PostWithJson 发送带有JSON字符串的POST请求.
PostWithJsonString 发送带 JSON 数据的 POST 请求.
No description provided by the author
RemoveTaints 从现有的 taints 中删除指定的 taints.
RenderTerraformTemplate 渲染 Terraform 模板并写入指定目录的 main.tf 文件.
No description provided by the author
SetupTerraform 初始化并计划 Terraform 在指定目录.
StringSliceToMap 将 []string 转换为 map[string]string,要求输入长度为偶数,奇数索引为 key,偶数索引为 value.
Success 操作成功的返回.
SuccessWithData 带数据的操作成功返回.
SuccessWithDetails 带详细数据和消息的操作成功返回.
SuccessWithMessage 带消息的操作成功返回.
ToLowerCase 将字符串转换为小写.
ToUpperCase 将字符串转换为大写.
TrimSpaces 去掉字符串的前后空格.
Unauthorized 未认证的返回,使用HTTP 401状态码.
UnauthorizedErrorWithDetails 带详细数据和消息的未认证返回.

# Constants

No description provided by the author
操作失败.
操作成功.

# Variables

升级器.

# Structs

ApiResponse 通用的API响应结构体.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
LabelOption 通用返回结构体,用于前后端交互的数据格式.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author