From 3b48952750a827c0002711b635f4162f108f7ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=98=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2?= Date: Wed, 11 Sep 2024 10:43:52 +0300 Subject: [PATCH] Modify CI --- cldcbdb_client/main.go | 59 ------------ jetcli/main.go | 30 ------ jetcli/methods/methods.go | 198 -------------------------------------- 3 files changed, 287 deletions(-) delete mode 100644 cldcbdb_client/main.go delete mode 100644 jetcli/main.go delete mode 100644 jetcli/methods/methods.go diff --git a/cldcbdb_client/main.go b/cldcbdb_client/main.go deleted file mode 100644 index a1c0bb9..0000000 --- a/cldcbdb_client/main.go +++ /dev/null @@ -1,59 +0,0 @@ -package main - -import ( - "encoding/json" - "errors" - tnt15 "github.com/lomik/go-tnt" - "gitlab.corp.mail.ru/cloud/workdisk/libs.git/log" - "gitlab.corp.mail.ru/cloud/workdisk/libs.git/tarantool15" - "time" -) - -type ProjectInfo struct { - IsPaidTariff *bool `json:"is_paid_tariff"` - Users uint32 `json:"users"` - FreezeAt *uint64 `json:"freeze_at"` - TariffEndTime *uint64 `json:"tariff_end_time"` - PID string `json:"id"` - Space uint64 `json:"space"` - Cost float64 `json:"cost"` - Status string `json:"status"` -} - -func main() { - cli := tarantool15.NewPool( - "cloudbilling", - []string{"localhost:3301"}, - &tnt15.Options{ - ConnectTimeout: 10 * time.Second, - QueryTimeout: 10 * time.Second, - }, nil, "cloudbiz") - cli.Start() - - tuples, err := cli.CallARO("cloud_info", &tnt15.Call{ - Name: tnt15.Bytes("cloudbilling.api"), - Tuple: tnt15.Tuple{ - tnt15.Bytes("requestID"), - tnt15.Bytes("cloud_info"), - tnt15.Bytes("pid"), - tnt15.Bytes("2"), - }, - }) - if err != nil { - var tntErr tarantool15.Error - if !errors.As(err, &tntErr) || tntErr.Status != 404 { - log.WithError(err).Fatal("call cloudbilling with jeneric err") - } - } - - log. - WithStringField("status", string(tuples[0][0])). - WithStringField("message", string(tuples[0][1])). - Infof("cloud_info response") - - var response ProjectInfo - if err = json.Unmarshal(tuples[0][1], &response); err != nil { - log.WithError(err).Error("unmarshall response") - } - log.Infof("func response: %+v", response) -} diff --git a/jetcli/main.go b/jetcli/main.go deleted file mode 100644 index 93c38c2..0000000 --- a/jetcli/main.go +++ /dev/null @@ -1,30 +0,0 @@ -package main - -import ( - "flag" - "tests/jetcli/methods" -) - -var ( - method = flag.String("method", "", "biz method") - args = methods.Args{ - URL: flag.String("url", "127.0.0.1:80", "jet address"), - AuthUser: flag.String("auth_user", "nobody", "jet user"), - AuthPassword: flag.String("auth_password", "nopass", "jet password"), - PID: flag.Uint64("pid", 0, "pid"), - Name: flag.String("name", "", "name"), - UID: flag.Uint64("uid", 0, "uid"), - Email: flag.String("email", "", "email"), - TreeID: flag.String("tree_id", "", "tree_id"), - Operation: flag.Uint64("operation", 0, "operation"), - Quota: flag.Uint64("quota", 0, "quota"), - Mode: flag.Uint64("mode", 0, "mode"), - ToSet: flag.String("to_set", "", "to_set"), - ToUnset: flag.String("to_unset", "", "to_unset"), - } -) - -func main() { - flag.Parse() - methods.Call(method, args) -} diff --git a/jetcli/methods/methods.go b/jetcli/methods/methods.go deleted file mode 100644 index 5ad2721..0000000 --- a/jetcli/methods/methods.go +++ /dev/null @@ -1,198 +0,0 @@ -package methods - -import ( - "context" - "log" - "time" - - "gitlab.corp.mail.ru/cloud/go/jet/pkg/configured" - "gitlab.corp.mail.ru/cloud/go/jet/pkg/jet" -) - -type Args struct { - URL *string - AuthUser *string - AuthPassword *string - PID *uint64 - Name *string - UID *uint64 - Email *string - TreeID *string - Operation *uint64 - Quota *uint64 - Mode *uint64 - ToSet *string - ToUnset *string -} - -func Call(method *string, args Args) { - ctx := context.Background() - client := jet.New(configured.JetClientConfig{ - URL: "http://" + *args.URL, - Timeout: 10 * time.Second, - BasicAuthCred: configured.BasicAuthConfig{ - Username: *args.AuthUser, - Password: *args.AuthPassword, - }, - }) - switch *method { - case "project_register": - err := client.BizProjectRegister(ctx, "some_request_id", &jet.BizProjectRegisterRequest{ - PID: *args.PID, - Name: *args.Name, - }) - if err != nil { - log.Fatal(err.Error()) - } - case "project_delete": - err := client.BizProjectDelete(ctx, "some_request_id", &jet.BizProjectDeleteRequest{ - PID: *args.PID, - }) - if err != nil { - log.Fatal(err.Error()) - } - case "catalog_acl_ctl": - err := client.BizCatalogACLCtl(ctx, "some_request_id", &jet.BizCatalogACLCtlRequest{ - PID: *args.PID, - TreeID: []byte(*args.TreeID), - UID: *args.UID, - Operation: uint8(*args.Operation), - }) - if err != nil { - log.Fatal(err.Error()) - } - case "catalog_acl_list": - resp, err := client.BizCatalogACLList(ctx, "some_request_id", &jet.BizCatalogACLListRequest{ - PID: *args.PID, - TreeID: []byte(*args.TreeID), - }) - if err != nil { - log.Fatal(err.Error()) - } - log.Printf("Method response: %#v", resp) - case "catalog_create": - resp, err := client.BizCatalogCreate(ctx, "some_request_id", &jet.BizCatalogCreateRequest{ - PID: *args.PID, - Name: *args.Name, - Quota: *args.Quota, - }) - if err != nil { - log.Fatal(err.Error()) - } - log.Printf("Method response: %#v", resp) - case "catalog_delete": - err := client.BizCatalogDelete(ctx, "some_request_id", &jet.BizCatalogDeleteRequest{ - PID: *args.PID, - TreeID: []byte(*args.TreeID), - }) - if err != nil { - log.Fatal(err.Error()) - } - case "catalog_mount": - err := client.BizCatalogMount(ctx, "some_request_id", &jet.BizCatalogMountRequest{ - PID: *args.PID, - TreeID: []byte(*args.TreeID), - UID: *args.UID, - Mode: uint8(*args.Mode), - }) - if err != nil { - log.Fatal(err.Error()) - } - case "catalog_umount": - err := client.BizCatalogUMount(ctx, "some_request_id", &jet.BizCatalogUMountRequest{ - PID: *args.PID, - TreeID: []byte(*args.TreeID), - UID: *args.UID, - }) - if err != nil { - log.Fatal(err.Error()) - } - case "catalog_quota_set": - err := client.BizCatalogQuotaSet(ctx, "some_request_id", &jet.BizCatalogQuotaSetRequest{ - PID: *args.PID, - TreeID: []byte(*args.TreeID), - Quota: *args.Quota, - }) - if err != nil { - log.Fatal(err.Error()) - } - case "user_register": - err := client.BizUserRegister(ctx, "some_request_id", &jet.BizUserRegisterRequest{ - PID: *args.PID, - UID: *args.UID, - Email: *args.Email, - Quota: *args.Quota, - }) - if err != nil { - log.Fatal(err.Error()) - } - case "user_delete": - err := client.BizUserDelete(ctx, "some_request_id", &jet.BizUserRequest{ - PID: *args.PID, - UID: *args.UID, - }) - if err != nil { - log.Fatal(err.Error()) - } - case "user_block": - err := client.BizUserBlock(ctx, "some_request_id", &jet.BizUserRequest{ - PID: *args.PID, - UID: *args.UID, - }) - if err != nil { - log.Fatal(err.Error()) - } - case "user_unblock": - err := client.BizUserUnblock(ctx, "some_request_id", &jet.BizUserRequest{ - PID: *args.PID, - UID: *args.UID, - }) - if err != nil { - log.Fatal(err.Error()) - } - case "user_flags_get": - resp, err := client.BizUserFlagsGet(ctx, "some_request_id", &jet.BizUserRequest{ - PID: *args.PID, - UID: *args.UID, - }) - if err != nil { - log.Fatal(err.Error()) - } - log.Printf("Method response: %#v", resp) - case "user_flags_set": - resp, err := client.BizUserFlagsSet(ctx, "some_request_id", &jet.BizUserSetFlagsRequest{ - PID: *args.PID, - UID: *args.UID, - ToSet: []string{*args.ToSet}, - ToUnset: []string{*args.ToUnset}, - }) - if err != nil { - log.Fatal(err.Error()) - } - log.Printf("Method response: %#v", resp) - case "user_quota_set": - resp, err := client.BizUserQuotaSet(ctx, "some_request_id", &jet.BizUserSetQuotaRequest{ - PID: *args.PID, - UID: *args.UID, - Operation: uint8(*args.Operation), - Quota: *args.Quota, - }) - if err != nil { - log.Fatal(err.Error()) - } - log.Printf("Method response: %#v", resp) - case "user_du": - resp, err := client.BizUserDU(ctx, "some_request_id", &jet.BizUserRequest{ - PID: *args.PID, - UID: *args.UID, - }) - if err != nil { - log.Fatal(err.Error()) - } - log.Printf("Method response: %#v", resp) - - default: - log.Fatalf("unknown method: %s", *method) - } - log.Print("command applied successfully") -}