5.8. アプリケーションプランの作成

3scale toolbox を使用して、デベロッパーポータルのアプリケーションプランの作成、更新、一覧表示、削除、表示、またはエクスポート/インポートを行います。

5.8.1. 新しいアプリケーションプランの作成

新しいアプリケーションプランを作成するには、以下の手順に従います。

  • アプリケーションプラン名を指定する必要があります。
  • system-name を上書きするには、オプションのパラメーターを使用します。
  • 同じ名前のアプリケーションプランがすでに存在する場合、エラーメッセージが表示されます。
  • --default フラグを使用して、アプリケーションプランを デフォルト として設定します。
  • --publish フラグを使用して、公開済み アプリケーションプランを作成します。

    • デフォルトでは、非表示 になります。
  • --disabled フラグを使用して、無効な アプリケーションプランを作成します。

    • デフォルトでは、有効 になります。
注記
  • service 位置引数はサービスの参照で、サービスの id またはサービスの system_name のどちらかです。

    • toolbox は、どちらか一方を使用します。

以下のコマンドにより、新しいアプリケーションプランが作成されます。

3scale application-plan create [opts] <remote> <service> <plan-name>

アプリケーションプランの作成時に、以下のオプションを使用します。

Options
       --approval-required=<value>    The application requires approval:
                                      true or false
       --cost-per-month=<value>       Cost per month
       --default                      Make the default application plan
       --disabled                     Disable all methods and metrics in
                                      the application plan
    -o --output=<value>               Output format on stdout:
                                      one of json|yaml
    -p --published                    Publish the application plan
       --setup-fee=<value>            Set-up fee
    -t --system-name=<value>          Set application plan system name
       --trial-period-days=<value>    The trial period in days

Options for application-plan
    -c --config-file=<value>          3scale toolbox configuration file:
                                      defaults to $HOME/.3scalerc.yaml
    -h --help                         Print help for this command
    -k --insecure                     Proceed and operate even for server
                                      connections otherwise considered
                                      insecure
    -v --version                      Print the version of this command
       --verbose                      Verbose mode

5.8.2. アプリケーションプランの作成または更新

アプリケーションプランが存在しない場合に新しく作成する、または既存のアプリケーションプランを更新するには、以下の手順に従います。

  • --default フラグを使用して、デフォルト アプリケーションプランを更新します。
  • --publish フラグを使用して、公開済み アプリケーションプランを更新します。
  • --hide フラグを使用して、非表示の アプリケーションを更新します。
  • --disabled フラグを使用して、無効な アプリケーションプランを更新します。
  • --enabled フラグを使用して、有効な アプリケーションプランを更新します。
注記
  • service 位置引数はサービスの参照で、サービスの id またはサービスの system_name のどちらかです。

    • toolbox は、どちらか一方を使用します。
  • plan 位置引数はプランの参照で、プランの id またはプランの system_name のどちらかです。

    • toolbox は、どちらか一方を使用します。

以下のコマンドにより、アプリケーションプランが更新されます。

3scale application-plan create [opts] <remote> <service> <plan>

アプリケーションプランの更新時に、以下のオプションを使用します。

Options
       --approval-required=<value>    The application requires approval:
                                      true or false
       --cost-per-month=<value>       Cost per month
       --default                      Make the default application plan
       --disabled                     Disable all methods and metrics in
                                      the application plan
       --enabled                      Enable the application plan
       --hide                         Hide the application plan
    -n --name=<value>                 Set the plan name
    -o --output=<value>               Output format on stdout:
                                      one of json|yaml
    -p --publish                      Publish the application plan
       --setup-fee=<value>            Set-up fee
       --trial-period-days=<value>    The trial period in days

Options for application-plan
    -c --config-file=<value>          3scale toolbox configuration file:
                                      defaults to $HOME/.3scalerc.yaml
    -h --help                         Print help for this command
    -k --insecure                     Proceed and operate even for server
                                      connections otherwise considered
                                      insecure
    -v --version                      Print the version of this command
       --verbose                      Verbose mode

5.8.3. アプリケーションプランの一覧表示

以下のコマンドにより、アプリケーションプランが一覧表示されます。

3scale application-plan list [opts] <remote> <service>

アプリケーションプランの一覧表示時に、以下のオプションを使用します。

Options
    -o --output=<value>           Output format on stdout:
                                  one of json|yaml

Options for application-plan
    -c --config-file=<value>      3scale toolbox configuration file:
                                  defaults to $HOME/.3scalerc.yaml
    -h --help                     Print help for this command
    -k --insecure                 Proceed and operate even for server
                                  connections otherwise considered insecure
    -v --version                  Print the version of this command
       --verbose                  Verbose mode

5.8.4. アプリケーションプランの表示

以下のコマンドにより、アプリケーションプランが表示されます。

3scale application-plan show [opts] <remote> <service> <plan>

アプリケーションプランの表示時に、以下のオプションを使用します。

Options
    -o --output=<value>           Output format on stdout:
                                  one of json|yaml

Options for application-plan
    -c --config-file=<value>      3scale toolbox configuration file:
                                  defaults to $HOME/.3scalerc.yaml
    -h --help                     Print help for this command
    -k --insecure                 Proceed and operate even for server
                                  connections otherwise considered insecure
    -v --version                  Print the version of this command
       --verbose                  Verbose mode

5.8.5. アプリケーションプランの削除

以下のコマンドにより、アプリケーションプランが削除されます。

3scale application-plan delete [opts] <remote> <service> <plan>

アプリケーションプランの削除時に、以下のオプションを使用します。

Options for application-plan
    -c --config-file=<value>      3scale toolbox configuration file:
                                  defaults to $HOME/.3scalerc.yaml
    -h --help                     Print help for this command
    -k --insecure                 Proceed and operate even for server
                                  connections otherwise considered insecure
    -v --version                  Print the version of this command
       --verbose                  Verbose mode

5.8.6. アプリケーションプランのエクスポート/インポート

単一のアプリケーションプランを yaml コンテンツにエクスポートすることや、コンテンツからインポートすることができます。

次の点に注意してください。

  • アプリケーションプランで定義される制限が含まれます。
  • アプリケーションプランで定義される課金ルールが含まれます。
  • 制限および課金ルールで参照されるメトリクス/メソッドが含まれます。
  • アプリケーションプランで定義される機能が含まれます。
  • サービスは id または system_name で参照できます。
  • アプリケーションプランは id または system_name で参照できます。

5.8.6.1. ファイルへのアプリケーションプランのエクスポート

以下のコマンドにより、アプリケーションプランがエクスポートされます。

3scale application-plan export [opts] <remote> <service_system_name> <plan_system_name>

$ podman run -u root -v $PWD:/tmp registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.11 3scale application-plan export --file=/tmp/plan.yaml remote_name service_name plan_name

この例では、Podman ボリュームを使用して、エクスポートされたファイルをコンテナーにマウントし、現在の $PWD フォルダーに出力します。

注記

export コマンドに固有の事項

  • リモートサービスおよびアプリケーションプランでは、読み取り専用操作になります。
  • コマンド出力は、stdout またはファイルのどちらかです。

    • -f オプションで指定しない場合、デフォルトでは、yaml コンテンツは stdout に書き出されます。

アプリケーションプランのエクスポート時に、以下のオプションを使用します。

Options
    -f --file=<value>             Write to file instead of stdout

Options for application-plan
    -c --config-file=<value>      3scale toolbox configuration file:
                                  defaults to $HOME/.3scalerc.yaml
    -h --help                     Print help for this command
    -k --insecure                 Proceed and operate even for server
                                  connections otherwise considered insecure
    -v --version                  Print the version of this command
       --verbose                  Verbose mode

5.8.6.2. ファイルからのアプリケーションプランのインポート

以下のコマンドにより、アプリケーションプランがインポートされます。

3scale application-plan import [opts] <remote> <service_system_name>

$ podman run -v $PWD/plan.yaml:/tmp/plan.yaml registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.11 3scale application-plan import --file=/tmp/plan.yaml remote_name service_name

この例では、Podman ボリュームを使用して、現在の $PWD フォルダーからインポートされたファイルをコンテナーにマウントします。

5.8.6.3. URL からのアプリケーションプランのインポート

3scale application-plan import -f http[s]://domain/resource/path.yaml remote_name service_name
注記

import コマンドに固有の事項

  • コマンド入力コンテンツは、stdin、ファイル、または URL 形式のいずれかです。

    • -f オプションで指定しない場合、デフォルトでは、yaml コンテンツは stdin から読み込まれます。
  • アプリケーションプランがリモートサービスで見つからない場合は、アプリケーションプランが作成されます。
  • オプションのパラメーター -p--plan を使用すると、リモートターゲットのアプリケーションプランの id または system_name が上書きされます。

    • -p オプションで指定されていない場合、デフォルトでは、yaml コンテンツからのプラン属性 system_name によってアプリケーションプランが参照されます。
  • yaml コンテンツからのメトリクスまたはメソッドがリモートサービスで見つからない場合は、メトリクスまたはメソッドが作成されます。

アプリケーションプランのインポート時に、以下のオプションを使用します。

Options
    -f --file=<value>                  Read from file or URL instead of
                                       stdin
    -p --plan=<value>                  Override application plan reference

Options for application-plan
    -c --config-file=<value>           3scale toolbox configuration file:
                                       defaults to $HOME/.3scalerc.yaml
    -h --help                          Print help for this command
    -k --insecure                      Proceed and operate even for server
                                       connections otherwise considered
                                       insecure
    -v --version                       Print the version of this command
       --verbose                       Verbose mode