UiPath Documentation
uipath-cli
latest
false
UiPath CLI 用户指南
重要 :
请注意,此内容已使用机器翻译进行了本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

UIP 解决方案资源

“uip 解决方案资源”的语法和选项,用于管理本地解决方案所依赖的 Orchestrator 和 Data Service 资源。

uip solution resources管理本地解决方案所依赖的资源,包括队列、资产、存储桶、流程、连接、实体、选项集以及其他 Orchestrator 和 Data Service 对象。每个项目的资源绑定都被聚合到解决方案自己的资源列表中;使用此命令组对其进行检查、添加、编辑操作,或在编辑项目绑定后重新同步单元格。

备注:

不要与uip or混淆

uip or为实时租户上的 Orchestrator 服务器端队列、资产、存储桶等提供 CRUD。uip solution resources检查和编辑本地解决方案对这些资源的声明列表- 其在磁盘上的文件,而不是实时租户的文件。list --source remoteadd --source remote 会调用 Orchestrator 进行查找,但结果始终会写入本地解决方案。

大纲

uip solution resources list      [--solution-folder <path>] [--kind <kind>] [--search <term>] [--source <all|local|remote>] [--include-version] [--login-validity <minutes>]
uip solution resources get       <resource-key> [--solution-folder <path>] [--include-dependencies] [--login-validity <minutes>]
uip solution resources add       --source <local|remote> --kind <kind> --name <name> [--type <type>] [--folder-path <path>] [--cloud-key <guid>] [--solution-folder <path>] [--login-validity <minutes>]
uip solution resources remove    <resource-key> [--solution-folder <path>]
uip solution resources edit      <resource-key> --patch <json> [--solution-folder <path>]
uip solution resources refresh   [--solution-folder <path>] [--login-validity <minutes>]
uip solution resources list      [--solution-folder <path>] [--kind <kind>] [--search <term>] [--source <all|local|remote>] [--include-version] [--login-validity <minutes>]
uip solution resources get       <resource-key> [--solution-folder <path>] [--include-dependencies] [--login-validity <minutes>]
uip solution resources add       --source <local|remote> --kind <kind> --name <name> [--type <type>] [--folder-path <path>] [--cloud-key <guid>] [--solution-folder <path>] [--login-validity <minutes>]
uip solution resources remove    <resource-key> [--solution-folder <path>]
uip solution resources edit      <resource-key> --patch <json> [--solution-folder <path>]
uip solution resources refresh   [--solution-folder <path>] [--login-validity <minutes>]

所有六个动词都接受 --solution-folder <path>(默认为当前目录) — 不接受位置路径参数。

列表

列出解决方案中和/或 Orchestrator 中的可用资源。默认情况下 (--source all),同时返回本地声明的资源以及关联远程租户的资源 Orchestrator 报告;当两者都列出时,则对与本地条目通过 Kind:Name(不区分大小写)匹配的远程条目进行重复数据删除处理,而非本地条目。

选项

默认描述
--solution-folder路径当前目录解决方案根文件夹的路径。
--kindtext按资源种类筛选(例如,QueueAssetBucketProcessConnectionAppIndexTriggerEntityChoiceSet)。接受 SDK 索引的任何类型 — 这不是固定的枚举。
--searchtext资源名称的包含匹配项
--sourceall | local | remoteall列出哪侧。
--include-version标记关闭对于包含一号 (appappVersionpackageprocess) 的类型,同时报告每个资源的部署版本。每个资源会导致一次额外调用,因此默认情况下处于关闭状态。
--login-validity分钟10在令牌过期前触发刷新的最短分钟数。

示例

# All resources the current solution knows about
uip solution resources list

# Only queues declared locally
uip solution resources list --kind Queue --source local

# Deployed version per folder for classic Apps
uip solution resources list --kind app --source remote --include-version
# All resources the current solution knows about
uip solution resources list

# Only queues declared locally
uip solution resources list --kind Queue --source local

# Deployed version per folder for classic Apps
uip solution resources list --kind app --source remote --include-version

数据形状(--输出 json)

{
  "Code": "ResourceList",
  "Data": [
    {
      "Source": "Remote",
      "Key": "0c2b7f04-1d3e-4a55-9f77-2b1a6d9e4c81",
      "Name": "InvoiceQueue",
      "Kind": "queue",
      "Folder": "Shared"
    },
    {
      "Source": "Remote",
      "Key": "a9c9d05f-6d85-41cd-8a54-a479d494bedc",
      "Name": "Validation App",
      "Kind": "app",
      "Folder": "Shared/Validation",
      "FolderKey": "0932a1f4-5cd1-44d4-9f02-cdc92244a6d2",
      "Version": "12.0.0"
    }
  ]
}
{
  "Code": "ResourceList",
  "Data": [
    {
      "Source": "Remote",
      "Key": "0c2b7f04-1d3e-4a55-9f77-2b1a6d9e4c81",
      "Name": "InvoiceQueue",
      "Kind": "queue",
      "Folder": "Shared"
    },
    {
      "Source": "Remote",
      "Key": "a9c9d05f-6d85-41cd-8a54-a479d494bedc",
      "Name": "Validation App",
      "Kind": "app",
      "Folder": "Shared/Validation",
      "FolderKey": "0932a1f4-5cd1-44d4-9f02-cdc92244a6d2",
      "Version": "12.0.0"
    }
  ]
}
备注:

--source remote(和 all)需要经过身份验证的会话,该会话有权访问解决方案的目标 Orchestrator。

按键获取解决方案资源的配置,即 SDK 公开的规范、锁和元数据。如果该密钥不在本地解决方案中,则回退到实时 Orchestrator/资源目录查找,因此该命令仍适用于尚未绑定到解决方案的资源。

参数

名称必填用途
<resource-key>解决方案资源密钥 — GUID 或组合密钥,例如 TestRPA.process.TestRPA:1.0.0 用于包。

选项

默认描述
--solution-folder路径当前目录解决方案根文件夹的路径。
--include-dependencies标记关闭同时返回资源引用的每个依赖项的配置。
--login-validity分钟10在令牌过期前触发刷新的最短分钟数。

示例

uip solution resources get fb39bc38-255e-4fea-93c6-7c7eb44d766f

uip solution resources get fb39bc38-255e-4fea-93c6-7c7eb44d766f \
  --solution-folder ./my-solution --include-dependencies
uip solution resources get fb39bc38-255e-4fea-93c6-7c7eb44d766f

uip solution resources get fb39bc38-255e-4fea-93c6-7c7eb44d766f \
  --solution-folder ./my-solution --include-dependencies

数据形状(--输出 json)

{
  "Code": "ResourceConfiguration",
  "Data": {
    "key": "fb39bc38-255e-4fea-93c6-7c7eb44d766f",
    "spec": { "name": "RPA Workflow", "type": "Process" },
    "locks": [],
    "apiVersion": "orchestrator.uipath.com/v1",
    "isOverridable": true
  }
}
{
  "Code": "ResourceConfiguration",
  "Data": {
    "key": "fb39bc38-255e-4fea-93c6-7c7eb44d766f",
    "spec": { "name": "RPA Workflow", "type": "Process" },
    "locks": [],
    "apiVersion": "orchestrator.uipath.com/v1",
    "isOverridable": true
  }
}

如果链接的实时资源已偏离本地声明,则响应会在过时的 liveSpec 旁边添加 spec(当前实时规范),并且 resourceOverwrite.matchingOverwriteConfiguration: false

{
  "Code": "ResourceConfiguration",
  "Data": {
    "key": "0f8a1c9e-2b47-4d0a-9c31-5e2f6d8a7b10",
    "spec": { "name": "Approval App", "version": "7.0.0" },
    "liveSpec": { "name": "Approval App", "version": "12.0.0" },
    "resourceOverwrite": { "matchingOverwriteConfiguration": false }
  }
}
{
  "Code": "ResourceConfiguration",
  "Data": {
    "key": "0f8a1c9e-2b47-4d0a-9c31-5e2f6d8a7b10",
    "spec": { "name": "Approval App", "version": "7.0.0" },
    "liveSpec": { "name": "Approval App", "version": "12.0.0" },
    "resourceOverwrite": { "matchingOverwriteConfiguration": false }
  }
}

--include-dependencies 将返回 Code: "ResourceConfigurations",并带有 resources 数组,每个条目会添加 namekinddependencies

添加

向解决方案添加资源。--source local 创建不进行远程查找的虚拟存根; --source remote 导入现有的 Orchestrator 资源。幂等:与相同 (kind, name, folder)(或者在远程路径上与相同已解析云密钥)匹配的资源按原样返回,不会造成重复。

选项

默认描述
--sourcelocal | remote必填。 local 创建虚拟存根; remote 从 Orchestrator 导入。
--kindtext必需。资源种类(例如 QueueAssetBucketProcessConnectionAppIndexTriggerEntityChoiceSet)。不区分大小写。
--nametext必需。资源名称(最多 256 个字符;不能包含 / \ : * ? " < > | 或控制字符)。
--typetext资源子类型(例如,Text BoolInteger为 / /AssetConnection 为连接器类型)。对于 SDK 按 (kind, type) 建立索引的种类,这是必需的,除非可从远程匹配中解析。
--folder-path路径用于远程查找的 Orchestrator 文件夹路径;存在多个远程匹配项时可消除歧义。不适用于 --source local
--cloud-keyGUID跳过远程名称搜索并导入此确切的资源密钥。仅与 --source remote 一起有效。
--solution-folder路径当前目录解决方案根文件夹的路径。
--login-validity分钟10在令牌过期前触发刷新的最短分钟数。

如果远程名称搜索与多个资源匹配,该命令将失败,并会列出每个候选对象的文件夹、类型和键,以便您使用 --cloud-key 消除歧义。

示例

# Create a local virtual stub (no remote lookup)
uip solution resources add --source local --kind Queue --name InvoiceQueue

# Import an existing remote queue, disambiguated by folder path
uip solution resources add --source remote --kind Queue --name InvoiceQueue \
  --folder-path Sales/CRM
# Create a local virtual stub (no remote lookup)
uip solution resources add --source local --kind Queue --name InvoiceQueue

# Import an existing remote queue, disambiguated by folder path
uip solution resources add --source remote --kind Queue --name InvoiceQueue \
  --folder-path Sales/CRM

数据形状(--输出 json)

{
  "Code": "ResourceAdded",
  "Data": {
    "Key": "8f3a1b2c-0000-0000-0000-000000000001",
    "Kind": "queue",
    "Type": null,
    "Name": "InvoiceQueue",
    "Folder": "solution_folder",
    "FolderKey": "5c2d61f4-0000-0000-0000-000000000001",
    "Source": "local",
    "Status": "Added"
  }
}
{
  "Code": "ResourceAdded",
  "Data": {
    "Key": "8f3a1b2c-0000-0000-0000-000000000001",
    "Kind": "queue",
    "Type": null,
    "Name": "InvoiceQueue",
    "Folder": "solution_folder",
    "FolderKey": "5c2d61f4-0000-0000-0000-000000000001",
    "Source": "local",
    "Status": "Added"
  }
}

StatusAddedUpdatedUnchanged(幂等无操作情况)之一。

remove

通过密钥从解决方案中删除资源。纯本地 — 不需要身份验证,并且不会动用任何项目的 bindings_v2.json

参数

名称必填用途
<resource-key>解决方案资源密钥 (GUID)。使用 resources listresources get 来发现它。

选项

默认描述
--solution-folder路径当前目录解决方案根文件夹的路径。

示例

uip solution resources remove 8f3a1b2c-1234-4abc-9def-0123456789ab
uip solution resources remove 8f3a1b2c-1234-4abc-9def-0123456789ab

数据形状(--输出 json)

{
  "Code": "ResourceRemoved",
  "Data": {
    "Key": "8f3a1b2c-1234-4abc-9def-0123456789ab",
    "Kind": "queue",
    "Name": "InvoiceQueue",
    "Folder": "solution_folder"
  }
}
{
  "Code": "ResourceRemoved",
  "Data": {
    "Key": "8f3a1b2c-1234-4abc-9def-0123456789ab",
    "Kind": "queue",
    "Name": "InvoiceQueue",
    "Folder": "solution_folder"
  }
}

编辑

按 键编辑资源的规范属性。--patch 接受属性的 JSON 对象 → 值,并合并到现有规范中; SDK 标记为引用/只读/未知的属性将被静默忽略。getedit 数据形状匹配,因此获取 → 修改 → 编辑的往返过程非常简单。--source remote 会从导入资源的云定义中获取值,而不是 --patch

参数

名称必填用途
<resource-key>解决方案资源密钥 (GUID)。

选项

默认描述
--patchJSON 或 -规范属性的 JSON 对象 → 值。传递 - 以从标准输入读取 JSON。
--sourcelocal | remotelocal新值的来源:--patch (local) 或云定义 (remote)。
--force标记关闭使用 --source remote,将云定义写入本地定义。
--solution-folder路径当前目录解决方案根文件夹的路径。
--login-validity分钟10在令牌过期前触发刷新的最短分钟数。仅由 --source remote 使用。

示例

uip solution resources edit 8f3a1b2c-1234-4abc-9def-0123456789ab \
  --patch '{"maxNumberOfRetries":5}'

# Pipeline-friendly: patch from stdin
echo '{"slaInHours":"4"}' | uip solution resources edit 8f3a1b2c-... --patch -

# Pull the cloud definition: report the differences, then overwrite
uip solution resources edit 8f3a1b2c-... --source remote
uip solution resources edit 8f3a1b2c-... --source remote --force
uip solution resources edit 8f3a1b2c-1234-4abc-9def-0123456789ab \
  --patch '{"maxNumberOfRetries":5}'

# Pipeline-friendly: patch from stdin
echo '{"slaInHours":"4"}' | uip solution resources edit 8f3a1b2c-... --patch -

# Pull the cloud definition: report the differences, then overwrite
uip solution resources edit 8f3a1b2c-... --source remote
uip solution resources edit 8f3a1b2c-... --source remote --force

数据形状(--输出 json)

{
  "Code": "ResourceEdited",
  "Data": {
    "key": "8f3a1b2c-1234-4abc-9def-0123456789ab",
    "spec": { "name": "InvoiceQueue", "maxNumberOfRetries": 5 },
    "locks": [],
    "apiVersion": "orchestrator.uipath.com/v1"
  }
}
{
  "Code": "ResourceEdited",
  "Data": {
    "key": "8f3a1b2c-1234-4abc-9def-0123456789ab",
    "spec": { "name": "InvoiceQueue", "maxNumberOfRetries": 5 },
    "locks": [],
    "apiVersion": "orchestrator.uipath.com/v1"
  }
}

如果使用 --source remote,而不使用 --force,则命令不会写入任何内容:它会退出 1,并命名不同的属性。如果没有什么不同,则它将通过 Code: "ResourceRemoteDrift"Applied: false 成功。对于 --force,响应为 ResourceEdited,并包含 ChangedSkipped(资源种类不允许 SDK 写入的属性)和 Applied: true

refresh

重新扫描解决方案中的每个项目,并同步其 bindings_v2.json 文件中的资源声明。创建尚未出现在解决方案资源列表中的绑定;导入与现有 Orchestrator 资源匹配的绑定;系统会剪除先前运行时从部署文件夹中导入的解决方案自己项目的重复副本。编辑项目绑定后,请运行此方法,以同步解决方案的资源清单。

选项

默认描述
--solution-folder路径当前目录解决方案根文件夹的路径。
--login-validity分钟10在令牌过期前触发刷新的最短分钟数。

示例

uip solution resources refresh
uip solution resources refresh

数据形状(--输出 json)

{
  "Code": "ResourceRefresh",
  "Data": {
    "Created": 2,
    "Imported": 1,
    "Skipped": 5,
    "Pruned": 0,
    "Warnings": [],
    "Status": "Synced 3 resources (5 already in solution)"
  }
}
{
  "Code": "ResourceRefresh",
  "Data": {
    "Created": 2,
    "Imported": 1,
    "Skipped": 5,
    "Pruned": 0,
    "Warnings": [],
    "Status": "Synced 3 resources (5 already in solution)"
  }
}

Created 是全新的解决方案资源计数; Imported 是与 Orchestrator 匹配的计数; Skipped 对已具有匹配解决方案条目的绑定进行计数; Pruned 对重复项目副本进行计数(非零时,仅在 Status 中命名)。Warnings 是同步中人类可读注释的列表(如果是全新运行,则为空)。

退出代码

请参阅共享合同的退出代码

另请参阅

  • 全局选项--output--output-filter--log-level--log-file
  • 退出代码— 标准退出代码合同。

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新