Flex Gateway新着情報
Governance新着情報
Monitoring API ManagerAnypoint Flex Gateway には、ゲートウェイの API インスタンス、サービス、設定、使用可能な拡張機能 (ポリシー) に関連した情報を照会できる flexctl dump CLI が含まれています。
たとえば、次のインラインスニペットは、デフォルトの名前空間で jsonplaceholder-api という単独の API インスタンスを定義します (名前空間名画明確に指定されていないため default のままになっています)。 また、このスニペットは http-basic-authentication-flex という内部ポリシーを定義しています。
Linux デプロイメントで flexctl dump を実行するには、ユーザーを flex ユーザーグループに追加するか、sudo コマンドを使用して flexctl dump を実行します。詳細は、Linux 権限のトラブルシューティングを参照してください。
|
apiVersion: gateway.mulesoft.com/v1alpha1
kind: ApiInstance
metadata:
name: jsonplaceholder-api
spec:
address: http://0.0.0.0:8080
services:
jsonplaceholder:
address: https://jsonplaceholder.typicode.com:443/
routes:
- rules:
- path: /api(/users/.*)
- path: /api(/comments/.*)
policies:
- policyRef:
name: http-basic-authentication-flex
config:
username: chris
password: admin
API インスタンス、サービス、設定、拡張機能の JSON 表現を確認するには、次のコマンドを実行します。
flexctl dump
|
Docker または Podman コンテナで実行している場合は、このコマンドをコンテナ自身の中で実行してください。 |
このコマンドでは 4 つのファイルが出力されます。
api-instances.json
services.json
configuration.json
extensions.json
ファイル名が続く cat を実行し、JSON ファイルのコンテンツを表示します。
API インスタンス
サービス
設定
Extensions (拡張機能)
cat api-instances.json
api-instances.json ファイルのコンテンツは次のようになります。
[
{
"address":"http://0.0.0.0:8080",
"kind":"ApiInstance",
"name":"jsonplaceholder-api",
"namespace":"default",
"policies":[
{
"config":{
"password":"admin",
"username":"chris"
},
"extension":{
"kind":"Extension",
"name":"http-basic-authentication-flex",
"namespace":"default"
},
"kind":"Policy",
"name":"jsonplaceholder-api-http-basic-authentication-flex-1",
"namespace":"default"
},
{
"config":{
"destinationRef":{
"kind":"Service",
"name":"jsonplaceholder-api-jsonplaceholder",
"namespace":"default"
}
}
"extension":{
"kind":"Extension",
"name":"route",
"namespace":"default"
},
"kind":"Policy",
"name":"jsonplaceholder-api-jsonplaceholder-route-1",
"namespace":"default",
"order":50,
"rules":[
{
"path":"/api(/users/.*)"
},
{
"path":"/api(/comments/.*)"
}
]
},
{
"extension":{
"kind":"Extension",
"name":"envoy.filters.http.router",
"namespace":"default"
},
"kind":"Policy",
"name":"envoy.filters.http.router",
"namespace":"default",
"order":2147483647
}
]
}
]
cat services.json
services.json ファイルのコンテンツは次のようになります。
[
{
"address":"https://jsonplaceholder.typicode.com:443/",
"kind":"Service",
"name":"jsonplaceholder-api-jsonplaceholder",
"namespace":"default"
}
]
cat configuration.json
configuration.json ファイルのコンテンツは次のようになります。
{
"internalMetrics": {
"enabled": false
},
"logging": {},
"platformConnection": {
"anypoint": {
"url": "https://anypoint.mulesoft.com"
},
"environment": {
"cluster_id": "4aa281e9-1a1d-4c56-8669-2d887b2e1938",
"env_id": "ad067f80-69ee-4abb-9d05-bec98ece1e20",
"org_id": "1caa0b9b-4f4d-43c4-a1b6-f925a8c77baa"
},
"logging": {
"certificate": {
"cert": "demo-local.pem",
"key": "demo-local.key"
},
"url": "https://logging.ingestion.us-east-1.msap.io/ingestion/api/v1/logging"
},
"metering": {
"certificate": {
"cert": "demo-local.pem",
"key": "demo-local.key"
},
"url": "https://metering.ingestion.us-east-1.msap.io/ingestion/api/v1/metering"
},
"mode": "offline",
"monitoring": {
"certificate": {
"cert": "demo-local.pem",
"key": "demo-local.key"
},
"url": "https://monitoring.ingestion.us-east-1.msap.io/ingestion/api/v1/monitoring"
},
"runtimeEvents": {
"certificate": {
"cert": "demo-local.pem",
"key": "demo-local.key"
},
"url": "https://anypoint.mulesoft.com/apiruntime/v1/events"
}
},
"resourceLimits": {
"apiInstances": 100,
"policies": 400
},
"sharedStorage": {},
"version": "1.1.0"
}
cat extensions.json
extensions.json ファイルには Flex Gateway で使用できるすべてのポリシーが含まれます。このファイルのコンテンツは次のようになります。
{
"extends": [
{
"kind": "Extension",
"labels": {
"flex.mulesoft.com/created-by": "flex-filesystem",
"flex.mulesoft.com/managed-by": "flex-filesystem"
},
"name": "extension-definition",
"namespace": "default"
},
{
"kind": "Extension",
"labels": {
"flex.mulesoft.com/created-by": "flex-filesystem",
"flex.mulesoft.com/managed-by": "flex-filesystem"
},
"name": "extension-qos",
"namespace": "default"
}
],
"kind": "Extension",
"labels": {
"flex.mulesoft.com/created-by": "flex-filesystem",
"flex.mulesoft.com/managed-by": "flex-filesystem"
},
"name": "header-injection-definition",
"namespace": "default",
"properties": [
{
"name": "config",
"properties": [
{
"items": {
"name": "inboundHeaders",
"properties": [
{
"name": "key",
"type": "stringOrDataweave"
},
{
"name": "value",
"type": "stringOrDataweave"
}
],
"type": "object"
},
"name": "inboundHeaders",
"type": "array"
},
{
"items": {
"name": "outboundHeaders",
"properties": [
{
"name": "key",
"type": "stringOrDataweave"
},
{
"name": "value",
"type": "stringOrDataweave"
}
],
"type": "object"
},
"name": "outboundHeaders",
"type": "array"
}
],
"type": "object"
}
]
}