6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

API ConnectのCLIで、APIのオンライン/オフラインを制御する方法

Last updated at Posted at 2017-09-27

やりたいこと

API Connectでは、APIを製品という単位でグルーピングして公開することができます。公開した後、特定のAPIだけをアクセスを停止したい場合は、APIマネージャーの画面上で、特定のAPIをオフラインにすることができます。
このAPI単位でのオフライン/オンラインの制御を、API Connectの開発ツールとして提供されている、Developer Toolkitに含まれるCLIから実行することができます。
今回は、このDeveloper ToolkitのCLIを使って、公開しているAPIのオンライン/オフラインを制御をしてみたいと思います。

参考マニュアル

実行

Developrt ToolkitのCLIからAPIをオフラインにする

まずCLIからログインを行います。

$ apic login --username <ユーザー名> --password <パスワード> --server <APIマネージャーのアドレス>

ログインを行なった後、特定のAPIのオンライン/オフラインは以下のコマンドで行います。プロバイダー組織に属するユーザー情報を指定する必要があります。

$ apic apis:set <API名>:<APIのバージョン> --status <offline | online> --catalog <カタログ名> --organization <プロバイダー組織名> --server <APIマネージャーのアドレス>

以下は、「test-provider」というプロバイダー組織「test」カタログ上の、「loan」APIのバージョン1.0.0をオフラインにする例です。

$ apic apis:set loan:1.0.0 --status offline --catalog test --organization test-provider --server manager.apic.com
test-provider:test の loan:1.0.0 が更新されました (状況: offline)

APIマネージャーのカタログの製品一覧の画面上で確認して見ると、以下のようにオフラインになっています。
product-status.jpeg

実際にオフラインにしたAPIにリクエストしてみると、呼び出しができずに応答が返ってこないことが確認できます。

同じ手順で、オフラインに変更することもできます。

以上、Developer ToolkitのCLIを使って、公開しているAPIのオンライン/オフラインを制御する方法でした。
Developer Toolkitでは、CLIでいろいろなことができるので、運用管理も便利に使えそうです。

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?