|
@@ -21,40 +21,6 @@ var name string
|
|
|
var baseUrl string
|
|
|
var httpClient *http_client.Client
|
|
|
|
|
|
-type (
|
|
|
- ConfigKey struct {
|
|
|
- Namespace string `json:"namespace" form:"namespace" binding:"required"`
|
|
|
- Name string `json:"name" form:"name" binding:"required"`
|
|
|
- }
|
|
|
-
|
|
|
- DeleteMultiObjJsonBody struct {
|
|
|
- ConfigKey
|
|
|
- ObjNames []string `json:"objNames" binding:"required"`
|
|
|
- Prefix string `json:"prefix"`
|
|
|
- }
|
|
|
- CopyJsonBody struct {
|
|
|
- ConfigKey
|
|
|
- SrcObjName string `json:"srcObjName" binding:"required"`
|
|
|
- DstObjName string `json:"dstObjName" binding:"required"`
|
|
|
- RequireInfos []string `json:"requireInfos"`
|
|
|
- Prefix string `json:"prefix"`
|
|
|
- }
|
|
|
- MoveJsonBody struct {
|
|
|
- ConfigKey
|
|
|
- SrcObjName string `json:"srcObjName" binding:"required"`
|
|
|
- DstObjName string `json:"dstObjName" binding:"required"`
|
|
|
- RequireInfos []string `json:"requireInfos"`
|
|
|
- Prefix string `json:"prefix"`
|
|
|
- }
|
|
|
- ZoomUrlJsonBody struct {
|
|
|
- ConfigKey
|
|
|
- ObjName string `json:"srcObjName" binding:"required"`
|
|
|
- Process string `json:"dstObjName" binding:"required"`
|
|
|
- RequireInfos []string `json:"requireInfos"`
|
|
|
- Prefix string `json:"prefix"`
|
|
|
- }
|
|
|
-)
|
|
|
-
|
|
|
func Destroy() {
|
|
|
if httpClient == nil {
|
|
|
return
|
|
@@ -514,6 +480,44 @@ func createImage(reader io.Reader, objName string) (string, error) {
|
|
|
return resp.Info, nil
|
|
|
}
|
|
|
|
|
|
+func GetUrlWithMetaData(objName string) (string, error) {
|
|
|
+ return getUrl(objName)
|
|
|
+}
|
|
|
+
|
|
|
+func GetUrlUrlWithMetaDataWithPrefix(objName string) (string, error) {
|
|
|
+ return getUrl(prefix + objName)
|
|
|
+}
|
|
|
+
|
|
|
+func getUrlWithMetaData(objName string) (UrlWithMetaData, error) {
|
|
|
+ var errResponse UrlWithMetaData
|
|
|
+ if strutils.IsStringEmpty(objName) {
|
|
|
+ return errResponse, nil
|
|
|
+ }
|
|
|
+
|
|
|
+ getResponse, err := httpClient.NewRequest(http_client.WithNewRequestTimeout(timeoutDuration)).
|
|
|
+ Get(baseUrl+"/operation/url/metaData/get",
|
|
|
+ http_client.WithRequestQueryParams(map[string]string{
|
|
|
+ "namespace": namespace,
|
|
|
+ "name": name,
|
|
|
+ "objName": objName,
|
|
|
+ }))
|
|
|
+ if err != nil {
|
|
|
+ return errResponse, err
|
|
|
+ }
|
|
|
+
|
|
|
+ resp := new(response.InfoResponse[UrlWithMetaData])
|
|
|
+ err = getResponse.Json(resp)
|
|
|
+ if err != nil {
|
|
|
+ return errResponse, err
|
|
|
+ }
|
|
|
+
|
|
|
+ if !resp.Success {
|
|
|
+ return errResponse, errors.New(resp.Msg)
|
|
|
+ }
|
|
|
+
|
|
|
+ return resp.Info, nil
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
|