mc tag

mc tag 命令用来添加、删除和列出与存储桶或对象关联的标签。语法如下:

C:\>mc tag -h
NAME:
  mc tag - manage tags for bucket and object(s)

USAGE:
  mc tag COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]

COMMANDS:
  list    list tags of a bucket or an object
  remove  remove tags assigned to a bucket or an object
  set     set tags for a bucket and object(s)

FLAGS:
  --config-dir value, -C value  path to configuration folder (default: "C:\\Users\\Administrator\\mc")
  --quiet, -q                   disable progress bar display
  --no-color                    disable color theme
  --json                        enable JSON lines formatted output
  --debug                       enable debug output
  --insecure                    disable SSL certificate verification
  --help, -h                    show help

mc tag list

列出存储桶或对象的标签,语法如下:

C:\>mc tag list -h
NAME:
  mc tag list - list tags of a bucket or an object

USAGE:
  mc tag list [COMMAND FLAGS] TARGET

FLAGS:
  --version-id value, --vid value  list tags of particular object version
  --rewind value                   list tags of particular object version at specified time
  --versions                       list tags on all versions for an object
  --config-dir value, -C value     path to configuration folder (default: "C:\\Users\\Administrator\\mc")
  --quiet, -q                      disable progress bar display
  --no-color                       disable color theme
  --json                           enable JSON lines formatted output
  --debug                          enable debug output
  --insecure                       disable SSL certificate verification
  --help, -h                       show help

DESCRIPTION:
   List tags assigned to a bucket or an object

示例

(1)列出分配给对象的标签。

D:\server\minio>mc tag list local/images/234281.jpg
Name : http://127.0.0.1:9000/images/234281.jpg ()
k1   : v1
k2   : v2

(2)列出分配给对象特定版本的标签。

D:\server\minio> mc tag list --version-id "ieQq7aXsyhlhDt47YURGlrucYY3GxWHa" myminio/testbucket/testobject

(3)列出分配给超过一周的对象版本的标签。

C:\> mc tag list --versions --rewind 7d myminio/testbucket/testobject

(4)以 JSON 格式列出分配给对象的标签。

D:\server\minio>mc tag list --json local/images/234281.jpg
{
  "tagset": {
    "k1": "v1",
    "k2": "v2"
  },
  "status": "success",
  "url": "http://127.0.0.1:9000/images/234281.jpg",
  "versionID": ""
}

(5)列出分配给存储桶的标签。

D:\server\minio>mc tag list local/images
Name : http://127.0.0.1:9000/images ()
k01  : v01
k02  : v02

(6)以 JSON 格式列出分配给存储桶的标签。

D:\server\minio>mc tag list --json local/images
{
  "tagset": {
    "k01": "v01",
    "k02": "v02"
  },
  "status": "success",
  "url": "http://127.0.0.1:9000/images",
  "versionID": ""
}

mc tag remove

删除分配给存储桶或对象的标签,语法如下:

C:\>mc tag remove -h
NAME:
  mc tag remove - remove tags assigned to a bucket or an object

USAGE:
  mc tag remove [COMMAND FLAGS] TARGET

FLAGS:
  --version-id value, --vid value  remove tags on a specific object version
  --rewind value                   remove tags on an object version at specified time
  --versions                       remote tags on multiple versions of an object
  --config-dir value, -C value     path to configuration folder (default: "C:\\Users\\Administrator\\mc")
  --quiet, -q                      disable progress bar display
  --no-color                       disable color theme
  --json                           enable JSON lines formatted output
  --debug                          enable debug output
  --insecure                       disable SSL certificate verification
  --help, -h                       show help

DESCRIPTION:
  Remove tags assigned to a bucket or an object.

示例

(1)删除分配给对象的标签。

C:\> mc tag remove myminio/testbucket/testobject

(2)删除分配给对象特定版本的标签。

C:\> mc tag remove --version-id "ieQq7aXsyhlhDt47YURGlrucYY3GxWHa" myminio/testbucket/testobject

(3)删除分配给超过一周的对象版本的标签

C:\> mc tag remove --versions --rewind 7d myminio/testbucket/testobject

(4)删除分配给存储桶的标签。

D:\server\minio>mc tag remove local/images
Tags removed for http://127.0.0.1:9000/images.

mc tag set

为存储桶和对象设置标签,语法如下:

C:\>mc tag set
NAME:
  mc tag set - set tags for a bucket and object(s)

USAGE:
  mc tag set [COMMAND FLAGS] TARGET TAGS

FLAGS:
  --version-id value, --vid value  set tags on a specific object version
  --rewind value                   set tags on a specific object version at specific time
  --versions                       set tags on multiple versions for an object
  --config-dir value, -C value     path to configuration folder (default: "C:\\Users\\Administrator\\mc")
  --quiet, -q                      disable progress bar display
  --no-color                       disable color theme
  --json                           enable JSON lines formatted output
  --debug                          enable debug output
  --insecure                       disable SSL certificate verification
  --help, -h                       show help

DESCRIPTION:
   Assign tags to a bucket or an object.

示例

(1)为对象分配标签。

# 列出 images 存储桶中的对象
D:\server\minio>mc ls local/images
[2021-07-15 13:22:14 CST] 232KiB 234281.jpg
[2021-07-15 13:22:14 CST] 173KiB 234313.jpg
[2021-07-15 13:22:14 CST] 274KiB 241623.jpg
[2021-07-15 13:22:14 CST] 185KiB 265270.jpg
[2021-07-15 13:22:00 CST] 229KiB 294528.jpg
[2021-07-17 07:54:10 CST]     0B 20210701\
[2021-07-17 07:54:10 CST]     0B 20210702\
[2021-07-17 07:54:10 CST]     0B 20210713\
[2021-07-17 07:54:10 CST]     0B 300x300\

# 为 234281.jpg 对象添加标签
D:\server\minio>mc tag set local/images/234281.jpg "k1=v1&k2=v2"
Tags set for http://127.0.0.1:9000/images/234281.jpg.

(2)为对象的特定版本分配标签。

D:\server\minio> mc tag set --version-id "ieQq7aXsyhlhDt47YURGlrucYY3GxWHa" local/images "key1=value1&key2=value2&key3=value3"
Tags set for http://127.0.0.1:9000/images.

(3)为超过一天的对象版本分配标签。

D:\server\minio>mc tag set --versions --rewind 1d local/images "k01=v01&k02=v02"
Tags set for http://127.0.0.1:9000/images.

(4)为存储桶分配标签。

# 列出别名为 local 的 MinIO 存储服务中的所有存储桶
D:\server\minio>mc ls local
[2021-07-10 08:57:48 CST]     0B files\
[2021-07-03 22:22:23 CST]     0B images\

# 为 images 存储桶添加标签
D:\server\minio>mc tag set local/images "key1=value1&key2=value2"
Tags set for http://127.0.0.1:9000/images.
说说我的看法
全部评论(
没有评论
关于
本网站属于个人的非赢利性网站,转载的文章遵循原作者的版权声明,如果原文没有版权声明,请来信告知:hxstrive@outlook.com
公众号