UiPath Documentation
uipath-cli
latest
false
UiPath CLI ユーザー ガイド
重要 :
このコンテンツは機械翻訳によって処理されています。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

操作方法: Orchestrator のリソースを管理する

「uip または」を使用して Orchestrator ランタイムのリソースを管理するための日常的なタスクです。アセット、バケット、ライブラリ、キュー、トリガー、Webhook などがあります。

uip orは、Orchestrator のランタイム リソース (アセット、バケット (およびその中のファイル)、ライブラリ、キュー (およびアイテム)、トリガー、Webhook など) に対する汎用の CRUD 画面であり、このガイドの他の場所で説明されているジョブ、プロセス、フォルダーの各コマンドも並んでいます。このページには、毎日発生するタスク (アセットの一括作成、バケットへのファイルの移動、キュー作業のディスパッチ、トリガーの検査) が、コピー/貼り付け可能なスニペットとして収集されています。

すべてのサブコマンドの完全なフラグ・リストは、 uip or リファレンス・ページとそのリソースごとのページにあります。このページでは、一般的な使用パターンについて説明します。

注:

uip or (このページ) は uip solution resourceとは異なります。 uip or は常に本稼働中のテナントで Orchestrator を呼び出します。uip solution resource は、ディスク上の .uipx ソリューション内のローカル リソース宣言のみを読み取ります。疑わしい場合は、プレフィックスを確認してください。

最初に知っておく必要のある規則​

スニペットが機能する前に:

  • 認証。すべての uip or 動詞は Orchestrator を呼び出します。最初に uip login を実行します。別のテナントを対象とする呼び出しの前にアクティブなテナントを切り替えるには、 uip login tenant set <name> を実行します。
  • フォルダーの範囲設定アセット、バケット、キュー、キュー アイテム、タイム/キュー トリガーはフォルダー スコープです。 渡す --folder-path (例:Shared) または --folder-key (GUID)、またはそのフラグがサポートされている --all-folders です。ライブラリ、API トリガー、Webhook は テナントを対象範囲と し、フォルダー フラグを拒否します。
  • キー。リスト動詞は GUID (key、 identifier、 uniqueKey) を返します。これらを get、 updateおよび deleteに渡します。数値 id フィールドは内部です。それらをコマンドに渡さないでください。
  • 破壊的な操作には -y, --yesが必要です。これらのリソースに対するすべての delete 動詞は、それなしでは実行を拒否します — CLI は対話的にプロンプトを出しません。
  • JSON が既定の出力です。以下のすべてのスニペットはこれに依存しています。 詳しくは、「出力形式」をご覧ください。

アセット​

CSV からアセットを一括デプロイする​

これは、最も一般的な「シークレットと構成の管理」タスクです。次のようなCSVがあるとします。

name,value,type,folderPath
ApiEndpoint,https://api.example.com,Text,Shared
MaxRetries,3,Integer,Shared
Debug,false,Bool,Shared
name,value,type,folderPath
ApiEndpoint,https://api.example.com,Text,Shared
MaxRetries,3,Integer,Shared
Debug,false,Bool,Shared

プレーンなbash + uip or assets createでループします。

#!/usr/bin/env bash
set -euo pipefail

# Skip the header row
tail -n +2 ./assets.csv | while IFS=, read -r name value type folder; do
  uip or assets create "$name" "$value" \
    --folder-path "$folder" \
    --type "$type"
done
#!/usr/bin/env bash
set -euo pipefail

# Skip the header row
tail -n +2 ./assets.csv | while IFS=, read -r name value type folder; do
  uip or assets create "$name" "$value" \
    --folder-path "$folder" \
    --type "$type"
done

重複すると、同じフォルダーに対してこれを再実行すると失敗します。これを処理するには、次の 2 つの方法があります。

  • パターンを更新/挿入します。最初にリストし、次に行ごとに create または update します。

    tail -n +2 ./assets.csv | while IFS=, read -r name value type folder; do
      existing=$(uip or assets list --folder-path "$folder" --name "$name" \
        --output-filter "Data[?name=='$name'] | [0].key" --output plain)
    
      if [ -n "$existing" ] && [ "$existing" != "null" ]; then
        uip or assets update "$existing" "$value"
      else
        uip or assets create "$name" "$value" --folder-path "$folder" --type "$type"
      fi
    done
    tail -n +2 ./assets.csv | while IFS=, read -r name value type folder; do
      existing=$(uip or assets list --folder-path "$folder" --name "$name" \
        --output-filter "Data[?name=='$name'] | [0].key" --output plain)
    
      if [ -n "$existing" ] && [ "$existing" != "null" ]; then
        uip or assets update "$existing" "$value"
      else
        uip or assets create "$name" "$value" --folder-path "$folder" --type "$type"
      fi
    done
    
  • ソリューションのデプロイ パターン。パッケージと一緒に出荷されるアセット セットの場合は、ソリューション マニフェストで宣言し、uip solution deploy run --config-file を使用します — そのパスは設計上べき等です。「 方法: ソリューションをパッケージ化してパブリッシュする」をご覧ください。

Credential タイプのアセット​

Credential アセットと Secret アセットには、資格情報ストア キーが必要です。

# Find the credential store
STORE_KEY=$(uip or credential-stores list \
  --output-filter "Data[?name=='MyStore'] | [0].key" --output plain)

# Create the credential asset (value format: username:password)
uip or assets create ApiLogin "alice:s3cr3t" \
  --folder-path Shared \
  --type Credential \
  --credential-store-key "$STORE_KEY"
# Find the credential store
STORE_KEY=$(uip or credential-stores list \
  --output-filter "Data[?name=='MyStore'] | [0].key" --output plain)

# Create the credential asset (value format: username:password)
uip or assets create ApiLogin "alice:s3cr3t" \
  --folder-path Shared \
  --type Credential \
  --credential-store-key "$STORE_KEY"

Credential と secret の値は、list や getによって返されることはありません。assets get-asset-value (フォルダー スコープが必要です) を使用してライブ値を読み取るか、ロボットを介して呼び出します。

フォルダー間でアセットを共有する​

Sharedに一度作成し、それを必要とする各フォルダーで共有します。

ASSET_KEY=$(uip or assets list --folder-path Shared --name ApiEndpoint \
  --output-filter "Data[0].key" --output plain)

for folder in Production Staging Development; do
  uip or assets share "$ASSET_KEY" --folder-path "$folder"
done
ASSET_KEY=$(uip or assets list --folder-path Shared --name ApiEndpoint \
  --output-filter "Data[0].key" --output plain)

for folder in Production Staging Development; do
  uip or assets share "$ASSET_KEY" --folder-path "$folder"
done

Revoke with unshare(で取り消します。完全な動詞のリストについては、 アセット を参照してください。

バケットとバケット ファイル​

ローカル ファイルをアップロードする​

BUCKET_KEY=$(uip or buckets list --folder-path Shared \
  --output-filter "Data[?name=='invoices'] | [0].key" --output plain)

uip or bucket-files upload "$BUCKET_KEY" "inbox/invoice-001.pdf" \
  --folder-path Shared \
  --file ./invoice-001.pdf
BUCKET_KEY=$(uip or buckets list --folder-path Shared \
  --output-filter "Data[?name=='invoices'] | [0].key" --output plain)

uip or bucket-files upload "$BUCKET_KEY" "inbox/invoice-001.pdf" \
  --folder-path Shared \
  --file ./invoice-001.pdf

バケット内のパス(inbox/invoice-001.pdf)は、 uploadの2番目の引数です。 --file アップロードするローカル パスです。コンテンツの種類は自動検出されます。オーバーライドする --content-type を渡します。

ファイルをダウンロードする​

uip or bucket-files download "$BUCKET_KEY" "reports/summary.csv" \
  --folder-path Shared \
  --destination ./summary.csv
uip or bucket-files download "$BUCKET_KEY" "reports/summary.csv" \
  --folder-path Shared \
  --destination ./summary.csv

--destinationを使用しない場合、コンテンツは stdout にストリーミングされ、プロセッサにパイプ接続するのに便利です。

リストとページネーション​

# First page
uip or bucket-files list "$BUCKET_KEY" --folder-path Shared

# The response carries a continuationToken — pass it back to fetch the next page
uip or bucket-files list "$BUCKET_KEY" --folder-path Shared \
  --continuation-token "<token-from-previous-response>"
# First page
uip or bucket-files list "$BUCKET_KEY" --folder-path Shared

# The response carries a continuationToken — pass it back to fetch the next page
uip or bucket-files list "$BUCKET_KEY" --folder-path Shared \
  --continuation-token "<token-from-previous-response>"

バケットファイルのリストは、オフセットページネーションではなく継続トークンを使用するCLIの1つのリソースであり、他のリスト動詞は --limit / --offsetを取ります。

署名済み URL​

ロボットまたは外部サービスが CLI を経由せずに直接 BLOB にアクセスする必要がある場合は、以下の手順を実行します。

uip or bucket-files get-upload-url "$BUCKET_KEY" "inbox/incoming.pdf" \
  --folder-path Shared --expiry-in-minutes 30

uip or bucket-files get-download-url "$BUCKET_KEY" "reports/summary.csv" \
  --folder-path Shared --expiry-in-minutes 30
uip or bucket-files get-upload-url "$BUCKET_KEY" "inbox/incoming.pdf" \
  --folder-path Shared --expiry-in-minutes 30

uip or bucket-files get-download-url "$BUCKET_KEY" "reports/summary.csv" \
  --folder-path Shared --expiry-in-minutes 30

どちらも、スコープが 1 つのファイル パスに限定された時間制限付きの URL を返します。

キューおよびキュー アイテム​

キューを作成する​

uip or queues create InvoiceQueue \
  --folder-path Shared \
  --max-retries 3 \
  --retention-period 90
uip or queues create InvoiceQueue \
  --folder-path Shared \
  --max-retries 3 \
  --retention-period 90

完全なフラグリスト( --auto-retry、 --enforce-unique-reference、 --encrypted、保持設定)は、 キューの参照にあります。

作業項目を 1 つ追加する​

uip or queue-items add InvoiceQueue \
  --folder-path Shared \
  --specific-content '{"InvoiceId":"INV-001","Amount":1500}' \
  --priority High
uip or queue-items add InvoiceQueue \
  --folder-path Shared \
  --specific-content '{"InvoiceId":"INV-001","Amount":1500}' \
  --priority High

--specific-content は、ロボットが読み取る JSON ペイロードです。

ファイルから一括追加​

cat > ./items.json <<'EOF'
[
  {"specificContent": {"InvoiceId":"INV-001"}, "priority": "Normal"},
  {"specificContent": {"InvoiceId":"INV-002"}, "priority": "Normal"}
]
EOF

ITEMS=$(jq -c . ./items.json)
uip or queue-items bulk-add InvoiceQueue \
  --folder-path Shared \
  --queue-items "$ITEMS" \
  --commit-type StopOnFirstFailure
cat > ./items.json <<'EOF'
[
  {"specificContent": {"InvoiceId":"INV-001"}, "priority": "Normal"},
  {"specificContent": {"InvoiceId":"INV-002"}, "priority": "Normal"}
]
EOF

ITEMS=$(jq -c . ./items.json)
uip or queue-items bulk-add InvoiceQueue \
  --folder-path Shared \
  --queue-items "$ITEMS" \
  --commit-type StopOnFirstFailure

各アイテムには、 priority、 reference、 deferDate、 dueDate specificContentを指定できます。アイテムごとのキュー名はありません。キューは、バッチ全体で共有される 1 つの位置引数 (上記のInvoiceQueue) です。

--commit-type 1 つの行が検証に失敗した場合の挙動を制御します。 ProcessAllIndependently (既定)、 StopOnFirstFailure、または AllOrNothingです。

失敗したアイテムを検査する​

uip or queue-items list --folder-path Shared \
  --queue-name InvoiceQueue \
  --status Failed \
  --output-filter "Data[].{key:uniqueKey, ref:reference, reason:processingException}"
uip or queue-items list --folder-path Shared \
  --queue-name InvoiceQueue \
  --status Failed \
  --output-filter "Data[].{key:uniqueKey, ref:reference, reason:processingException}"

1 つのuniqueKeyでqueue-items get-history を使用すると、その完全な状態遷移履歴が表示されるため、再試行ループの診断に役立ちます。

失敗したアイテムをリトライ対象としてマークする​

uip or queue-items set-review-status Retried \
  "<queue-item-key-1>" "<queue-item-key-2>"
uip or queue-items set-review-status Retried \
  "<queue-item-key-1>" "<queue-item-key-2>"

set-review-status は Retried、 Abandoned、 Deletedのいずれかを取ります。

トリガー​

フォルダー内のトリガーのリストを取得​

uip or triggers list --type time --folder-path Shared --enabled \
  --output-filter "Data[].{name:name, cron:startProcessCron, enabled:isEnabled}"
uip or triggers list --type time --folder-path Shared --enabled \
  --output-filter "Data[].{name:name, cron:startProcessCron, enabled:isEnabled}"

トリガーの 3 種類: time、queue、apiすべての動詞に --type を渡します(デフォルトは timeです)。API トリガーはテナント範囲です。 --folder-pathは省略します。

タイム トリガーを作成する​

RELEASE_KEY=$(uip or processes list --folder-path Shared --name InvoiceProcessing \
  --output-filter "Data[0].Key" --output plain)

uip or triggers create --type time \
  --name NightlyInvoices \
  --release-key "$RELEASE_KEY" \
  --runtime-type Unattended \
  --job-priority Normal \
  --folder-path Shared \
  --cron "0 0 2 * * ?" \
  --time-zone UTC
RELEASE_KEY=$(uip or processes list --folder-path Shared --name InvoiceProcessing \
  --output-filter "Data[0].Key" --output plain)

uip or triggers create --type time \
  --name NightlyInvoices \
  --release-key "$RELEASE_KEY" \
  --runtime-type Unattended \
  --job-priority Normal \
  --folder-path Shared \
  --cron "0 0 2 * * ?" \
  --time-zone UTC

--cron値は、標準の cron ではなく、Quartz の 6 フィールド形式 (sec min hour dayOfMonth month dayOfWeek) を使用します。"0 0 2 * * ?" は「毎日02:00」です。

トリガーを有効化または無効化する​

専用の enable/disable コマンドはありません。 updateを使用してトリガーを切り替えます。

uip or triggers update <trigger-key> --type time --folder-path Shared --disabled
uip or triggers update <trigger-key> --type time --folder-path Shared --enabled
uip or triggers update <trigger-key> --type time --folder-path Shared --disabled
uip or triggers update <trigger-key> --type time --folder-path Shared --enabled

triggers historyを使用して、起動していないトリガーを診断します—火災ログには、不足しているライセンス、使用できないマシン、およびその他のアップストリームブロックが表示されます。

Webhook​

Webhook はテナントスコープです。1 回作成すると、テナント内で一致するイベントごとに Webhook が発生します。

uip or webhooks create JobAlerts \
  --url https://hooks.example.com/uipath \
  --events "job.completed,job.faulted" \
  --secret "$WEBHOOK_SECRET"
uip or webhooks create JobAlerts \
  --url https://hooks.example.com/uipath \
  --events "job.completed,job.faulted" \
  --secret "$WEBHOOK_SECRET"

テナントで利用可能なイベントの種類を一覧表示します。

uip or webhooks event-types
uip or webhooks event-types

実際のイベントを待たずに配信をテストします。

uip or webhooks ping <webhook-key>
uip or webhooks ping <webhook-key>

ライブラリ​

ライブラリはテナント範囲 (フォルダー範囲ではない) です。テナント フィードに存在し、次のようなパッケージ ID で参照されますMyLib:1.0.0

# Upload a new version
uip or libraries upload --file ./MyLib.1.0.0.nupkg

# See all versions of a package
uip or libraries versions MyLib

# Download a specific version
uip or libraries download MyLib:1.0.0 --destination ./MyLib.1.0.0.nupkg
# Upload a new version
uip or libraries upload --file ./MyLib.1.0.0.nupkg

# See all versions of a package
uip or libraries versions MyLib

# Download a specific version
uip or libraries download MyLib:1.0.0 --destination ./MyLib.1.0.0.nupkg

キーの形式は PackageId:Version であり、GUID ではありません。

スクリプティングのヒント​

  • 変数に 1 つの値を渡すときは、必ず --output-filter を渡します。脆弱な jq 呼び出しを回避し、CLI解析時に検証します( スクリプトパターンを参照)。
  • List 動詞は、ページ分割された結果 (ほとんどの場合 --limit / --offset 、バケット ファイル --continuation-token ) を返します。空の結果( Dataの行がゼロ)は 0 を終了します—リストクエリは成功しました。一致するものは何もありませんでした。
  • ほとんどの更新/削除動詞はクロスフォルダです —uip orの各動詞のセクションのフラグテーブルには、明示的にそう書かれています(「クロスフォルダ」)。これらのリソースに対するフォルダー スコープが必要なのは、 create と list のみです。

参照​

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得