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:
@@ -140,7 +140,7 @@ func mainAdminBucketQuota(ctx *cli.Context) error {
|
||||
})).Trace(args...), "Unable to set bucket quota")
|
||||
|
||||
printMsg(quotaMessage{
|
||||
op: "set",
|
||||
op: ctx.Command.Name,
|
||||
Bucket: targetURL,
|
||||
Quota: quota,
|
||||
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")
|
||||
}
|
||||
printMsg(quotaMessage{
|
||||
op: "unset",
|
||||
op: ctx.Command.Name,
|
||||
Bucket: targetURL,
|
||||
Status: "success",
|
||||
})
|
||||
@@ -160,7 +160,7 @@ func mainAdminBucketQuota(ctx *cli.Context) error {
|
||||
qCfg, e := client.GetBucketQuota(globalContext, targetURL)
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to get bucket quota")
|
||||
printMsg(quotaMessage{
|
||||
op: "get",
|
||||
op: ctx.Command.Name,
|
||||
Bucket: targetURL,
|
||||
Quota: qCfg.Quota,
|
||||
QuotaType: string(qCfg.Type),
|
||||
|
||||
@@ -116,7 +116,7 @@ func mainClusterBucketImport(ctx *cli.Context) error {
|
||||
BucketMetaImportErrs: rpt,
|
||||
Status: "success",
|
||||
URL: aliasedURL,
|
||||
Op: "import",
|
||||
Op: ctx.Command.Name,
|
||||
})
|
||||
|
||||
return nil
|
||||
|
||||
@@ -136,7 +136,7 @@ func mainAdminGroupAdd(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(client.UpdateGroupMembers(globalContext, gAddRemove)).Trace(args...), "Unable to add new group")
|
||||
|
||||
printMsg(groupMessage{
|
||||
op: "add",
|
||||
op: ctx.Command.Name,
|
||||
GroupName: args.Get(1),
|
||||
Members: members,
|
||||
})
|
||||
|
||||
@@ -72,7 +72,7 @@ func mainAdminGroupInfo(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to fetch group info")
|
||||
|
||||
printMsg(groupMessage{
|
||||
op: "info",
|
||||
op: ctx.Command.Name,
|
||||
GroupName: group,
|
||||
GroupStatus: gd.Status,
|
||||
GroupPolicy: gd.Policy,
|
||||
|
||||
@@ -71,7 +71,7 @@ func mainAdminGroupList(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to list groups")
|
||||
|
||||
printMsg(groupMessage{
|
||||
op: "list",
|
||||
op: ctx.Command.Name,
|
||||
Groups: gs,
|
||||
})
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ func mainAdminGroupRemove(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Could not perform remove operation")
|
||||
|
||||
printMsg(groupMessage{
|
||||
op: "remove",
|
||||
op: ctx.Command.Name,
|
||||
GroupName: args.Get(1),
|
||||
Members: members,
|
||||
})
|
||||
|
||||
@@ -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")
|
||||
|
||||
printMsg(userPolicyMessage{
|
||||
op: "add",
|
||||
op: ctx.Command.Name,
|
||||
Policy: args.Get(1),
|
||||
})
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ func mainAdminPolicyInfo(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
printMsg(userPolicyMessage{
|
||||
op: "info",
|
||||
op: ctx.Command.Name,
|
||||
Policy: policyName,
|
||||
PolicyInfo: *pinfo,
|
||||
})
|
||||
|
||||
@@ -72,7 +72,7 @@ func mainAdminPolicyList(ctx *cli.Context) error {
|
||||
|
||||
for k := range policies {
|
||||
printMsg(userPolicyMessage{
|
||||
op: "list",
|
||||
op: ctx.Command.Name,
|
||||
Policy: k,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
printMsg(userPolicyMessage{
|
||||
op: "remove",
|
||||
op: ctx.Command.Name,
|
||||
Policy: args.Get(1),
|
||||
})
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ func mainAdminPolicySet(ctx *cli.Context) error {
|
||||
e := client.SetPolicy(globalContext, policyName, userOrGroup, isGroup)
|
||||
if e == nil {
|
||||
printMsg(userPolicyMessage{
|
||||
op: "set",
|
||||
op: ctx.Command.Name,
|
||||
Policy: policyName,
|
||||
UserOrGroup: userOrGroup,
|
||||
IsGroup: isGroup,
|
||||
|
||||
@@ -125,7 +125,7 @@ func mainAdminPolicyUnset(ctx *cli.Context) error {
|
||||
e = client.SetPolicy(globalContext, newPolicies, userOrGroup, isGroup)
|
||||
if e == nil {
|
||||
printMsg(userPolicyMessage{
|
||||
op: "unset",
|
||||
op: ctx.Command.Name,
|
||||
Policy: policiesToUnset,
|
||||
UserOrGroup: userOrGroup,
|
||||
IsGroup: isGroup,
|
||||
|
||||
@@ -130,7 +130,7 @@ func mainAdminPolicyUpdate(ctx *cli.Context) error {
|
||||
e = client.SetPolicy(globalContext, updatedPolicies, userOrGroup, isGroup)
|
||||
if e == nil {
|
||||
printMsg(userPolicyMessage{
|
||||
op: "update",
|
||||
op: ctx.Command.Name,
|
||||
Policy: policiesToAdd,
|
||||
UserOrGroup: userOrGroup,
|
||||
IsGroup: isGroup,
|
||||
|
||||
@@ -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")
|
||||
|
||||
msg := &tierMessage{
|
||||
op: "add",
|
||||
op: ctx.Command.Name,
|
||||
Status: "success",
|
||||
}
|
||||
msg.SetTierConfig(tCfg)
|
||||
|
||||
@@ -139,7 +139,7 @@ func mainAdminTierEdit(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to edit remote tier")
|
||||
|
||||
printMsg(&tierMessage{
|
||||
op: "edit",
|
||||
op: ctx.Command.Name,
|
||||
Status: "success",
|
||||
TierName: tierName,
|
||||
})
|
||||
|
||||
@@ -72,7 +72,7 @@ func mainAdminTierRm(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to remove remote tier target")
|
||||
|
||||
printMsg(&tierMessage{
|
||||
op: "rm",
|
||||
op: ctx.Command.Name,
|
||||
Status: "success",
|
||||
TierName: tierName,
|
||||
})
|
||||
|
||||
@@ -72,7 +72,7 @@ func mainAdminTierVerify(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to verify remote tier target")
|
||||
|
||||
printMsg(&tierMessage{
|
||||
op: "verify",
|
||||
op: ctx.Command.Name,
|
||||
Status: "success",
|
||||
TierName: tierName,
|
||||
})
|
||||
|
||||
@@ -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")
|
||||
|
||||
printMsg(userMessage{
|
||||
op: "add",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: accessKey,
|
||||
SecretKey: secretKey,
|
||||
UserStatus: "enabled",
|
||||
|
||||
@@ -72,7 +72,7 @@ func mainAdminUserDisable(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to disable user")
|
||||
|
||||
printMsg(userMessage{
|
||||
op: "disable",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: args.Get(1),
|
||||
})
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ func mainAdminUserEnable(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to enable user")
|
||||
|
||||
printMsg(userMessage{
|
||||
op: "enable",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: args.Get(1),
|
||||
})
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ func mainAdminUserInfo(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to get user info")
|
||||
|
||||
printMsg(userMessage{
|
||||
op: "info",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: args.Get(1),
|
||||
PolicyName: user.PolicyName,
|
||||
UserStatus: string(user.Status),
|
||||
|
||||
@@ -76,7 +76,7 @@ func mainAdminUserList(ctx *cli.Context) error {
|
||||
|
||||
for k, v := range users {
|
||||
printMsg(userMessage{
|
||||
op: "list",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: k,
|
||||
PolicyName: v.PolicyName,
|
||||
UserStatus: string(v.Status),
|
||||
|
||||
@@ -71,7 +71,7 @@ func mainAdminUserRemove(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to remove %s", args.Get(1))
|
||||
|
||||
printMsg(userMessage{
|
||||
op: "remove",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: args.Get(1),
|
||||
})
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ func mainAdminUserSvcAcctAdd(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to add a new service account")
|
||||
|
||||
printMsg(svcAcctMessage{
|
||||
op: "add",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: creds.AccessKey,
|
||||
SecretKey: creds.SecretKey,
|
||||
AccountStatus: "enabled",
|
||||
|
||||
@@ -77,7 +77,7 @@ func mainAdminUserSvcAcctDisable(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to disable the specified service account")
|
||||
|
||||
printMsg(svcAcctMessage{
|
||||
op: "disable",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: svcAccount,
|
||||
})
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ func mainAdminUserSvcAcctEnable(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to enable the specified service account")
|
||||
|
||||
printMsg(svcAcctMessage{
|
||||
op: "enable",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: svcAccount,
|
||||
})
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ func mainAdminUserSvcAcctInfo(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
printMsg(svcAcctMessage{
|
||||
op: "info",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: svcAccount,
|
||||
AccountStatus: svcInfo.AccountStatus,
|
||||
ParentUser: svcInfo.ParentUser,
|
||||
|
||||
@@ -78,7 +78,7 @@ func mainAdminUserSvcAcctList(ctx *cli.Context) error {
|
||||
|
||||
for _, svc := range svcList.Accounts {
|
||||
printMsg(svcAcctMessage{
|
||||
op: "list",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: svc,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func mainAdminUserSvcAcctRemove(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to remove the specified service account")
|
||||
|
||||
printMsg(svcAcctMessage{
|
||||
op: "rm",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: svcAccount,
|
||||
})
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ func mainAdminUserSvcAcctSet(ctx *cli.Context) error {
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to edit the specified service account")
|
||||
|
||||
printMsg(svcAcctMessage{
|
||||
op: "set",
|
||||
op: ctx.Command.Name,
|
||||
AccessKey: svcAccount,
|
||||
})
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ func mainEncryptClear(cliCtx *cli.Context) error {
|
||||
fatalIf(err, "Unable to initialize connection.")
|
||||
fatalIf(client.DeleteEncryption(ctx), "Unable to clear auto encryption configuration")
|
||||
printMsg(encryptClearMessage{
|
||||
Op: "clear",
|
||||
Op: cliCtx.Command.Name,
|
||||
Status: "success",
|
||||
URL: aliasedURL,
|
||||
})
|
||||
|
||||
@@ -109,7 +109,7 @@ func mainEncryptSet(cliCtx *cli.Context) error {
|
||||
}
|
||||
fatalIf(client.SetEncryption(ctx, algorithm, keyID), "Unable to enable auto encryption")
|
||||
msg := encryptSetMessage{
|
||||
Op: "set",
|
||||
Op: cliCtx.Command.Name,
|
||||
Status: "success",
|
||||
URL: aliasedURL,
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ func mainReplicateAdd(cliCtx *cli.Context) error {
|
||||
}
|
||||
fatalIf(client.SetReplication(ctx, &rcfg, opts), "Could not add replication rule")
|
||||
printMsg(replicateAddMessage{
|
||||
Op: "add",
|
||||
Op: cliCtx.Command.Name,
|
||||
URL: aliasedURL,
|
||||
ID: opts.ID,
|
||||
})
|
||||
|
||||
@@ -207,7 +207,7 @@ func mainReplicateEdit(cliCtx *cli.Context) error {
|
||||
|
||||
fatalIf(client.SetReplication(ctx, &rcfg, opts), "Could not modify replication rule")
|
||||
printMsg(replicateEditMessage{
|
||||
Op: "set",
|
||||
Op: cliCtx.Command.Name,
|
||||
URL: aliasedURL,
|
||||
ID: opts.ID,
|
||||
})
|
||||
|
||||
@@ -101,7 +101,7 @@ func mainReplicateExport(cliCtx *cli.Context) error {
|
||||
rCfg, err := client.GetReplication(ctx)
|
||||
fatalIf(err.Trace(args...), "Unable to get replication configuration")
|
||||
printMsg(replicateExportMessage{
|
||||
Op: "export",
|
||||
Op: cliCtx.Command.Name,
|
||||
Status: "success",
|
||||
URL: aliasedURL,
|
||||
ReplicationConfig: rCfg,
|
||||
|
||||
@@ -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")
|
||||
printMsg(replicateImportMessage{
|
||||
Op: "import",
|
||||
Op: cliCtx.Command.Name,
|
||||
Status: "success",
|
||||
URL: aliasedURL,
|
||||
})
|
||||
|
||||
@@ -132,7 +132,7 @@ func mainReplicateResyncStart(cliCtx *cli.Context) error {
|
||||
rinfo, err := client.ResetReplication(ctx, olderThan, cliCtx.String("remote-bucket"))
|
||||
fatalIf(err.Trace(args...), "Unable to reset replication")
|
||||
printMsg(replicateResyncMessage{
|
||||
Op: "start",
|
||||
Op: cliCtx.Command.Name,
|
||||
URL: aliasedURL,
|
||||
ResyncTargetsInfo: rinfo,
|
||||
})
|
||||
|
||||
@@ -152,7 +152,7 @@ func mainreplicateResyncStatus(cliCtx *cli.Context) error {
|
||||
rinfo, err := client.ReplicationResyncStatus(ctx, cliCtx.String("remote-bucket"))
|
||||
fatalIf(err.Trace(args...), "Unable to get replication resync status")
|
||||
printMsg(replicateResyncStatusMessage{
|
||||
Op: "status",
|
||||
Op: cliCtx.Command.Name,
|
||||
URL: aliasedURL,
|
||||
ResyncTargetsInfo: rinfo,
|
||||
TargetArn: cliCtx.String("remote-bucket"),
|
||||
|
||||
@@ -147,7 +147,7 @@ func mainReplicateRemove(cliCtx *cli.Context) error {
|
||||
fatalIf(client.SetReplication(ctx, &rcfg, opts), "Could not remove replication rule")
|
||||
}
|
||||
printMsg(replicateRemoveMessage{
|
||||
Op: "rm",
|
||||
Op: cliCtx.Command.Name,
|
||||
Status: "success",
|
||||
URL: aliasedURL,
|
||||
ID: ruleID,
|
||||
|
||||
@@ -199,7 +199,7 @@ func mainReplicateStatus(cliCtx *cli.Context) error {
|
||||
fatalIf(err.Trace(args...), "Unable to get replication status")
|
||||
|
||||
printMsg(replicateStatusMessage{
|
||||
Op: "status",
|
||||
Op: cliCtx.Command.Name,
|
||||
URL: aliasedURL,
|
||||
ReplicationStatus: replicateStatus,
|
||||
})
|
||||
|
||||
@@ -123,7 +123,7 @@ func mainVersionEnable(cliCtx *cli.Context) error {
|
||||
fatalIf(err, "Unable to initialize connection.")
|
||||
fatalIf(client.SetVersion(ctx, "enable", excludedPrefixes, excludeFolders), "Unable to enable versioning")
|
||||
printMsg(versionEnableMessage{
|
||||
Op: "enable",
|
||||
Op: cliCtx.Command.Name,
|
||||
Status: "success",
|
||||
URL: aliasedURL,
|
||||
})
|
||||
|
||||
@@ -105,7 +105,7 @@ func mainVersionInfo(cliCtx *cli.Context) error {
|
||||
vConfig, e := client.GetVersion(ctx)
|
||||
fatalIf(e, "Unable to get versioning info")
|
||||
vMsg := versioningInfoMessage{
|
||||
Op: "info",
|
||||
Op: cliCtx.Command.Name,
|
||||
Status: "success",
|
||||
URL: aliasedURL,
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func mainVersionSuspend(cliCtx *cli.Context) error {
|
||||
fatalIf(err, "Unable to initialize connection.")
|
||||
fatalIf(client.SetVersion(ctx, "suspend", nil, false), "Unable to suspend versioning")
|
||||
printMsg(versionSuspendMessage{
|
||||
Op: "suspend",
|
||||
Op: cliCtx.Command.Name,
|
||||
Status: "success",
|
||||
URL: aliasedURL,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user