1
0
mirror of https://github.com/minio/mc.git synced 2025-11-25 08:23:07 +03:00

modify operation type in message (#4339)

This commit is contained in:
dorman
2022-11-02 05:10:26 +08:00
committed by GitHub
parent b5ee028536
commit 2f5bf0c17f
43 changed files with 45 additions and 45 deletions

View File

@@ -140,7 +140,7 @@ func mainAdminBucketQuota(ctx *cli.Context) error {
})).Trace(args...), "Unable to set bucket quota") })).Trace(args...), "Unable to set bucket quota")
printMsg(quotaMessage{ printMsg(quotaMessage{
op: "set", op: ctx.Command.Name,
Bucket: targetURL, Bucket: targetURL,
Quota: quota, Quota: quota,
QuotaType: string(qType), QuotaType: string(qType),
@@ -151,7 +151,7 @@ func mainAdminBucketQuota(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to clear bucket quota config") fatalIf(probe.NewError(e).Trace(args...), "Unable to clear bucket quota config")
} }
printMsg(quotaMessage{ printMsg(quotaMessage{
op: "unset", op: ctx.Command.Name,
Bucket: targetURL, Bucket: targetURL,
Status: "success", Status: "success",
}) })
@@ -160,7 +160,7 @@ func mainAdminBucketQuota(ctx *cli.Context) error {
qCfg, e := client.GetBucketQuota(globalContext, targetURL) qCfg, e := client.GetBucketQuota(globalContext, targetURL)
fatalIf(probe.NewError(e).Trace(args...), "Unable to get bucket quota") fatalIf(probe.NewError(e).Trace(args...), "Unable to get bucket quota")
printMsg(quotaMessage{ printMsg(quotaMessage{
op: "get", op: ctx.Command.Name,
Bucket: targetURL, Bucket: targetURL,
Quota: qCfg.Quota, Quota: qCfg.Quota,
QuotaType: string(qCfg.Type), QuotaType: string(qCfg.Type),

View File

@@ -116,7 +116,7 @@ func mainClusterBucketImport(ctx *cli.Context) error {
BucketMetaImportErrs: rpt, BucketMetaImportErrs: rpt,
Status: "success", Status: "success",
URL: aliasedURL, URL: aliasedURL,
Op: "import", Op: ctx.Command.Name,
}) })
return nil return nil

View File

@@ -136,7 +136,7 @@ func mainAdminGroupAdd(ctx *cli.Context) error {
fatalIf(probe.NewError(client.UpdateGroupMembers(globalContext, gAddRemove)).Trace(args...), "Unable to add new group") fatalIf(probe.NewError(client.UpdateGroupMembers(globalContext, gAddRemove)).Trace(args...), "Unable to add new group")
printMsg(groupMessage{ printMsg(groupMessage{
op: "add", op: ctx.Command.Name,
GroupName: args.Get(1), GroupName: args.Get(1),
Members: members, Members: members,
}) })

View File

@@ -72,7 +72,7 @@ func mainAdminGroupInfo(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to fetch group info") fatalIf(probe.NewError(e).Trace(args...), "Unable to fetch group info")
printMsg(groupMessage{ printMsg(groupMessage{
op: "info", op: ctx.Command.Name,
GroupName: group, GroupName: group,
GroupStatus: gd.Status, GroupStatus: gd.Status,
GroupPolicy: gd.Policy, GroupPolicy: gd.Policy,

View File

@@ -71,7 +71,7 @@ func mainAdminGroupList(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to list groups") fatalIf(probe.NewError(e).Trace(args...), "Unable to list groups")
printMsg(groupMessage{ printMsg(groupMessage{
op: "list", op: ctx.Command.Name,
Groups: gs, Groups: gs,
}) })

View File

@@ -85,7 +85,7 @@ func mainAdminGroupRemove(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Could not perform remove operation") fatalIf(probe.NewError(e).Trace(args...), "Could not perform remove operation")
printMsg(groupMessage{ printMsg(groupMessage{
op: "remove", op: ctx.Command.Name,
GroupName: args.Get(1), GroupName: args.Get(1),
Members: members, Members: members,
}) })

View File

@@ -136,7 +136,7 @@ func mainAdminPolicyAdd(ctx *cli.Context) error {
fatalIf(probe.NewError(client.AddCannedPolicy(globalContext, args.Get(1), policy)).Trace(args...), "Unable to add new policy") fatalIf(probe.NewError(client.AddCannedPolicy(globalContext, args.Get(1), policy)).Trace(args...), "Unable to add new policy")
printMsg(userPolicyMessage{ printMsg(userPolicyMessage{
op: "add", op: ctx.Command.Name,
Policy: args.Get(1), Policy: args.Get(1),
}) })

View File

@@ -118,7 +118,7 @@ func mainAdminPolicyInfo(ctx *cli.Context) error {
} }
printMsg(userPolicyMessage{ printMsg(userPolicyMessage{
op: "info", op: ctx.Command.Name,
Policy: policyName, Policy: policyName,
PolicyInfo: *pinfo, PolicyInfo: *pinfo,
}) })

View File

@@ -72,7 +72,7 @@ func mainAdminPolicyList(ctx *cli.Context) error {
for k := range policies { for k := range policies {
printMsg(userPolicyMessage{ printMsg(userPolicyMessage{
op: "list", op: ctx.Command.Name,
Policy: k, Policy: k,
}) })
} }

View File

@@ -73,7 +73,7 @@ func mainAdminPolicyRemove(ctx *cli.Context) error {
fatalIf(probe.NewError(client.RemoveCannedPolicy(globalContext, args.Get(1))).Trace(args...), "Unable to remove policy") fatalIf(probe.NewError(client.RemoveCannedPolicy(globalContext, args.Get(1))).Trace(args...), "Unable to remove policy")
printMsg(userPolicyMessage{ printMsg(userPolicyMessage{
op: "remove", op: ctx.Command.Name,
Policy: args.Get(1), Policy: args.Get(1),
}) })

View File

@@ -107,7 +107,7 @@ func mainAdminPolicySet(ctx *cli.Context) error {
e := client.SetPolicy(globalContext, policyName, userOrGroup, isGroup) e := client.SetPolicy(globalContext, policyName, userOrGroup, isGroup)
if e == nil { if e == nil {
printMsg(userPolicyMessage{ printMsg(userPolicyMessage{
op: "set", op: ctx.Command.Name,
Policy: policyName, Policy: policyName,
UserOrGroup: userOrGroup, UserOrGroup: userOrGroup,
IsGroup: isGroup, IsGroup: isGroup,

View File

@@ -125,7 +125,7 @@ func mainAdminPolicyUnset(ctx *cli.Context) error {
e = client.SetPolicy(globalContext, newPolicies, userOrGroup, isGroup) e = client.SetPolicy(globalContext, newPolicies, userOrGroup, isGroup)
if e == nil { if e == nil {
printMsg(userPolicyMessage{ printMsg(userPolicyMessage{
op: "unset", op: ctx.Command.Name,
Policy: policiesToUnset, Policy: policiesToUnset,
UserOrGroup: userOrGroup, UserOrGroup: userOrGroup,
IsGroup: isGroup, IsGroup: isGroup,

View File

@@ -130,7 +130,7 @@ func mainAdminPolicyUpdate(ctx *cli.Context) error {
e = client.SetPolicy(globalContext, updatedPolicies, userOrGroup, isGroup) e = client.SetPolicy(globalContext, updatedPolicies, userOrGroup, isGroup)
if e == nil { if e == nil {
printMsg(userPolicyMessage{ printMsg(userPolicyMessage{
op: "update", op: ctx.Command.Name,
Policy: policiesToAdd, Policy: policiesToAdd,
UserOrGroup: userOrGroup, UserOrGroup: userOrGroup,
IsGroup: isGroup, IsGroup: isGroup,

View File

@@ -380,7 +380,7 @@ func mainAdminTierAdd(ctx *cli.Context) error {
fatalIf(probe.NewError(client.AddTier(globalContext, tCfg)).Trace(args...), "Unable to configure remote tier target") fatalIf(probe.NewError(client.AddTier(globalContext, tCfg)).Trace(args...), "Unable to configure remote tier target")
msg := &tierMessage{ msg := &tierMessage{
op: "add", op: ctx.Command.Name,
Status: "success", Status: "success",
} }
msg.SetTierConfig(tCfg) msg.SetTierConfig(tCfg)

View File

@@ -139,7 +139,7 @@ func mainAdminTierEdit(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to edit remote tier") fatalIf(probe.NewError(e).Trace(args...), "Unable to edit remote tier")
printMsg(&tierMessage{ printMsg(&tierMessage{
op: "edit", op: ctx.Command.Name,
Status: "success", Status: "success",
TierName: tierName, TierName: tierName,
}) })

View File

@@ -72,7 +72,7 @@ func mainAdminTierRm(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to remove remote tier target") fatalIf(probe.NewError(e).Trace(args...), "Unable to remove remote tier target")
printMsg(&tierMessage{ printMsg(&tierMessage{
op: "rm", op: ctx.Command.Name,
Status: "success", Status: "success",
TierName: tierName, TierName: tierName,
}) })

View File

@@ -72,7 +72,7 @@ func mainAdminTierVerify(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to verify remote tier target") fatalIf(probe.NewError(e).Trace(args...), "Unable to verify remote tier target")
printMsg(&tierMessage{ printMsg(&tierMessage{
op: "verify", op: ctx.Command.Name,
Status: "success", Status: "success",
TierName: tierName, TierName: tierName,
}) })

View File

@@ -187,7 +187,7 @@ func mainAdminUserAdd(ctx *cli.Context) error {
fatalIf(probe.NewError(client.AddUser(globalContext, accessKey, secretKey)).Trace(args...), "Unable to add new user") fatalIf(probe.NewError(client.AddUser(globalContext, accessKey, secretKey)).Trace(args...), "Unable to add new user")
printMsg(userMessage{ printMsg(userMessage{
op: "add", op: ctx.Command.Name,
AccessKey: accessKey, AccessKey: accessKey,
SecretKey: secretKey, SecretKey: secretKey,
UserStatus: "enabled", UserStatus: "enabled",

View File

@@ -72,7 +72,7 @@ func mainAdminUserDisable(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to disable user") fatalIf(probe.NewError(e).Trace(args...), "Unable to disable user")
printMsg(userMessage{ printMsg(userMessage{
op: "disable", op: ctx.Command.Name,
AccessKey: args.Get(1), AccessKey: args.Get(1),
}) })

View File

@@ -72,7 +72,7 @@ func mainAdminUserEnable(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to enable user") fatalIf(probe.NewError(e).Trace(args...), "Unable to enable user")
printMsg(userMessage{ printMsg(userMessage{
op: "enable", op: ctx.Command.Name,
AccessKey: args.Get(1), AccessKey: args.Get(1),
}) })

View File

@@ -71,7 +71,7 @@ func mainAdminUserInfo(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to get user info") fatalIf(probe.NewError(e).Trace(args...), "Unable to get user info")
printMsg(userMessage{ printMsg(userMessage{
op: "info", op: ctx.Command.Name,
AccessKey: args.Get(1), AccessKey: args.Get(1),
PolicyName: user.PolicyName, PolicyName: user.PolicyName,
UserStatus: string(user.Status), UserStatus: string(user.Status),

View File

@@ -76,7 +76,7 @@ func mainAdminUserList(ctx *cli.Context) error {
for k, v := range users { for k, v := range users {
printMsg(userMessage{ printMsg(userMessage{
op: "list", op: ctx.Command.Name,
AccessKey: k, AccessKey: k,
PolicyName: v.PolicyName, PolicyName: v.PolicyName,
UserStatus: string(v.Status), UserStatus: string(v.Status),

View File

@@ -71,7 +71,7 @@ func mainAdminUserRemove(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to remove %s", args.Get(1)) fatalIf(probe.NewError(e).Trace(args...), "Unable to remove %s", args.Get(1))
printMsg(userMessage{ printMsg(userMessage{
op: "remove", op: ctx.Command.Name,
AccessKey: args.Get(1), AccessKey: args.Get(1),
}) })

View File

@@ -183,7 +183,7 @@ func mainAdminUserSvcAcctAdd(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to add a new service account") fatalIf(probe.NewError(e).Trace(args...), "Unable to add a new service account")
printMsg(svcAcctMessage{ printMsg(svcAcctMessage{
op: "add", op: ctx.Command.Name,
AccessKey: creds.AccessKey, AccessKey: creds.AccessKey,
SecretKey: creds.SecretKey, SecretKey: creds.SecretKey,
AccountStatus: "enabled", AccountStatus: "enabled",

View File

@@ -77,7 +77,7 @@ func mainAdminUserSvcAcctDisable(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to disable the specified service account") fatalIf(probe.NewError(e).Trace(args...), "Unable to disable the specified service account")
printMsg(svcAcctMessage{ printMsg(svcAcctMessage{
op: "disable", op: ctx.Command.Name,
AccessKey: svcAccount, AccessKey: svcAccount,
}) })

View File

@@ -77,7 +77,7 @@ func mainAdminUserSvcAcctEnable(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to enable the specified service account") fatalIf(probe.NewError(e).Trace(args...), "Unable to enable the specified service account")
printMsg(svcAcctMessage{ printMsg(svcAcctMessage{
op: "enable", op: ctx.Command.Name,
AccessKey: svcAccount, AccessKey: svcAccount,
}) })

View File

@@ -96,7 +96,7 @@ func mainAdminUserSvcAcctInfo(ctx *cli.Context) error {
} }
printMsg(svcAcctMessage{ printMsg(svcAcctMessage{
op: "info", op: ctx.Command.Name,
AccessKey: svcAccount, AccessKey: svcAccount,
AccountStatus: svcInfo.AccountStatus, AccountStatus: svcInfo.AccountStatus,
ParentUser: svcInfo.ParentUser, ParentUser: svcInfo.ParentUser,

View File

@@ -78,7 +78,7 @@ func mainAdminUserSvcAcctList(ctx *cli.Context) error {
for _, svc := range svcList.Accounts { for _, svc := range svcList.Accounts {
printMsg(svcAcctMessage{ printMsg(svcAcctMessage{
op: "list", op: ctx.Command.Name,
AccessKey: svc, AccessKey: svc,
}) })
} }

View File

@@ -73,7 +73,7 @@ func mainAdminUserSvcAcctRemove(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to remove the specified service account") fatalIf(probe.NewError(e).Trace(args...), "Unable to remove the specified service account")
printMsg(svcAcctMessage{ printMsg(svcAcctMessage{
op: "rm", op: ctx.Command.Name,
AccessKey: svcAccount, AccessKey: svcAccount,
}) })

View File

@@ -98,7 +98,7 @@ func mainAdminUserSvcAcctSet(ctx *cli.Context) error {
fatalIf(probe.NewError(e).Trace(args...), "Unable to edit the specified service account") fatalIf(probe.NewError(e).Trace(args...), "Unable to edit the specified service account")
printMsg(svcAcctMessage{ printMsg(svcAcctMessage{
op: "set", op: ctx.Command.Name,
AccessKey: svcAccount, AccessKey: svcAccount,
}) })

View File

@@ -90,7 +90,7 @@ func mainEncryptClear(cliCtx *cli.Context) error {
fatalIf(err, "Unable to initialize connection.") fatalIf(err, "Unable to initialize connection.")
fatalIf(client.DeleteEncryption(ctx), "Unable to clear auto encryption configuration") fatalIf(client.DeleteEncryption(ctx), "Unable to clear auto encryption configuration")
printMsg(encryptClearMessage{ printMsg(encryptClearMessage{
Op: "clear", Op: cliCtx.Command.Name,
Status: "success", Status: "success",
URL: aliasedURL, URL: aliasedURL,
}) })

View File

@@ -109,7 +109,7 @@ func mainEncryptSet(cliCtx *cli.Context) error {
} }
fatalIf(client.SetEncryption(ctx, algorithm, keyID), "Unable to enable auto encryption") fatalIf(client.SetEncryption(ctx, algorithm, keyID), "Unable to enable auto encryption")
msg := encryptSetMessage{ msg := encryptSetMessage{
Op: "set", Op: cliCtx.Command.Name,
Status: "success", Status: "success",
URL: aliasedURL, URL: aliasedURL,
} }

View File

@@ -199,7 +199,7 @@ func mainReplicateAdd(cliCtx *cli.Context) error {
} }
fatalIf(client.SetReplication(ctx, &rcfg, opts), "Could not add replication rule") fatalIf(client.SetReplication(ctx, &rcfg, opts), "Could not add replication rule")
printMsg(replicateAddMessage{ printMsg(replicateAddMessage{
Op: "add", Op: cliCtx.Command.Name,
URL: aliasedURL, URL: aliasedURL,
ID: opts.ID, ID: opts.ID,
}) })

View File

@@ -207,7 +207,7 @@ func mainReplicateEdit(cliCtx *cli.Context) error {
fatalIf(client.SetReplication(ctx, &rcfg, opts), "Could not modify replication rule") fatalIf(client.SetReplication(ctx, &rcfg, opts), "Could not modify replication rule")
printMsg(replicateEditMessage{ printMsg(replicateEditMessage{
Op: "set", Op: cliCtx.Command.Name,
URL: aliasedURL, URL: aliasedURL,
ID: opts.ID, ID: opts.ID,
}) })

View File

@@ -101,7 +101,7 @@ func mainReplicateExport(cliCtx *cli.Context) error {
rCfg, err := client.GetReplication(ctx) rCfg, err := client.GetReplication(ctx)
fatalIf(err.Trace(args...), "Unable to get replication configuration") fatalIf(err.Trace(args...), "Unable to get replication configuration")
printMsg(replicateExportMessage{ printMsg(replicateExportMessage{
Op: "export", Op: cliCtx.Command.Name,
Status: "success", Status: "success",
URL: aliasedURL, URL: aliasedURL,
ReplicationConfig: rCfg, ReplicationConfig: rCfg,

View File

@@ -111,7 +111,7 @@ func mainReplicateImport(cliCtx *cli.Context) error {
fatalIf(client.SetReplication(ctx, rCfg, replication.Options{Op: replication.ImportOption}).Trace(aliasedURL), "Unable to set replication configuration") fatalIf(client.SetReplication(ctx, rCfg, replication.Options{Op: replication.ImportOption}).Trace(aliasedURL), "Unable to set replication configuration")
printMsg(replicateImportMessage{ printMsg(replicateImportMessage{
Op: "import", Op: cliCtx.Command.Name,
Status: "success", Status: "success",
URL: aliasedURL, URL: aliasedURL,
}) })

View File

@@ -132,7 +132,7 @@ func mainReplicateResyncStart(cliCtx *cli.Context) error {
rinfo, err := client.ResetReplication(ctx, olderThan, cliCtx.String("remote-bucket")) rinfo, err := client.ResetReplication(ctx, olderThan, cliCtx.String("remote-bucket"))
fatalIf(err.Trace(args...), "Unable to reset replication") fatalIf(err.Trace(args...), "Unable to reset replication")
printMsg(replicateResyncMessage{ printMsg(replicateResyncMessage{
Op: "start", Op: cliCtx.Command.Name,
URL: aliasedURL, URL: aliasedURL,
ResyncTargetsInfo: rinfo, ResyncTargetsInfo: rinfo,
}) })

View File

@@ -152,7 +152,7 @@ func mainreplicateResyncStatus(cliCtx *cli.Context) error {
rinfo, err := client.ReplicationResyncStatus(ctx, cliCtx.String("remote-bucket")) rinfo, err := client.ReplicationResyncStatus(ctx, cliCtx.String("remote-bucket"))
fatalIf(err.Trace(args...), "Unable to get replication resync status") fatalIf(err.Trace(args...), "Unable to get replication resync status")
printMsg(replicateResyncStatusMessage{ printMsg(replicateResyncStatusMessage{
Op: "status", Op: cliCtx.Command.Name,
URL: aliasedURL, URL: aliasedURL,
ResyncTargetsInfo: rinfo, ResyncTargetsInfo: rinfo,
TargetArn: cliCtx.String("remote-bucket"), TargetArn: cliCtx.String("remote-bucket"),

View File

@@ -147,7 +147,7 @@ func mainReplicateRemove(cliCtx *cli.Context) error {
fatalIf(client.SetReplication(ctx, &rcfg, opts), "Could not remove replication rule") fatalIf(client.SetReplication(ctx, &rcfg, opts), "Could not remove replication rule")
} }
printMsg(replicateRemoveMessage{ printMsg(replicateRemoveMessage{
Op: "rm", Op: cliCtx.Command.Name,
Status: "success", Status: "success",
URL: aliasedURL, URL: aliasedURL,
ID: ruleID, ID: ruleID,

View File

@@ -199,7 +199,7 @@ func mainReplicateStatus(cliCtx *cli.Context) error {
fatalIf(err.Trace(args...), "Unable to get replication status") fatalIf(err.Trace(args...), "Unable to get replication status")
printMsg(replicateStatusMessage{ printMsg(replicateStatusMessage{
Op: "status", Op: cliCtx.Command.Name,
URL: aliasedURL, URL: aliasedURL,
ReplicationStatus: replicateStatus, ReplicationStatus: replicateStatus,
}) })

View File

@@ -123,7 +123,7 @@ func mainVersionEnable(cliCtx *cli.Context) error {
fatalIf(err, "Unable to initialize connection.") fatalIf(err, "Unable to initialize connection.")
fatalIf(client.SetVersion(ctx, "enable", excludedPrefixes, excludeFolders), "Unable to enable versioning") fatalIf(client.SetVersion(ctx, "enable", excludedPrefixes, excludeFolders), "Unable to enable versioning")
printMsg(versionEnableMessage{ printMsg(versionEnableMessage{
Op: "enable", Op: cliCtx.Command.Name,
Status: "success", Status: "success",
URL: aliasedURL, URL: aliasedURL,
}) })

View File

@@ -105,7 +105,7 @@ func mainVersionInfo(cliCtx *cli.Context) error {
vConfig, e := client.GetVersion(ctx) vConfig, e := client.GetVersion(ctx)
fatalIf(e, "Unable to get versioning info") fatalIf(e, "Unable to get versioning info")
vMsg := versioningInfoMessage{ vMsg := versioningInfoMessage{
Op: "info", Op: cliCtx.Command.Name,
Status: "success", Status: "success",
URL: aliasedURL, URL: aliasedURL,
} }

View File

@@ -95,7 +95,7 @@ func mainVersionSuspend(cliCtx *cli.Context) error {
fatalIf(err, "Unable to initialize connection.") fatalIf(err, "Unable to initialize connection.")
fatalIf(client.SetVersion(ctx, "suspend", nil, false), "Unable to suspend versioning") fatalIf(client.SetVersion(ctx, "suspend", nil, false), "Unable to suspend versioning")
printMsg(versionSuspendMessage{ printMsg(versionSuspendMessage{
Op: "suspend", Op: cliCtx.Command.Name,
Status: "success", Status: "success",
URL: aliasedURL, URL: aliasedURL,
}) })