検索

10.6. Satellite API を使用したレポートテンプレートのインポート

download PDF

Satellite API を使用して、レポートテンプレートを Satellite にインポートできます。Satellite API を使用してレポートテンプレートをインポートすると、レポートテンプレートのメタデータが自動的に解析され、組織とロケーションが割り当てられます。Satellite API の使用に関する詳細は、API ガイド を参照してください。

前提条件

手順

  1. 以下の例を使用して、.json ファイルにインポートするテンプレートをフォーマットします。

    # cat Example_Template.json
    {
        "name": "Example Template Name",
        "template": "
        Enter ERB Code Here
    "
    }

    ERB テンプレートを含む JSON ファイルの例:

    {
        "name": "Hosts - complete list",
        "template": "
    <%#
    name: Hosts - complete list
    snippet: false
    template_inputs:
    - name: host
      required: false
      input_type: user
      advanced: false
      value_type: plain
      resource_type: Katello::ActivationKey
    model: ReportTemplate
    -%>
    <% load_hosts(search: input('host')).each_record do |host| -%>
    <%
          report_row(
              'Server FQDN': host.name
          )
    -%>
    <%  end -%>
    <%= report_render %>
    "
    }

  2. 以下のリクエストを使用して、テンプレートをインポートします。

    $ curl --insecure --user admin:redhat \
    --data @Example_Template.json --header "Content-Type:application/json" \
    --request POST --config https://satellite.example.com/api/report_templates/import
  3. 以下のリクエストを使用して、レポートテンプレートのリストを取得し、Satellite でテンプレートを表示できることを確認します。

    $ curl --insecure --user admin:redhat \
     --request GET --config https://satellite.example.com/api/report_templates | json_reformat
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.