環境定義型限制 CLI 外掛程式

IBM Cloud® 基於上下文的限制指令行介面 (CLI) 提供更多基於上下文的限制功能。 您可以使用此 CLI 外掛程式,根據存取請求的網路位置來管理 IBM Cloud® 資源的存取限制。

開始之前

  • 安裝 IBM Cloud CLI。 如需相關資訊,請參閱開始使用 IBM Cloud CLI。 使用 IBM Cloud CLI 來執行指令的字首是 ibmcloud
  • 執行指令之前,請使用 ibmcloud login 指令登入 IBM Cloud,以產生存取標記並驗證您的階段。

安裝環境定義型限制外掛程式

若要安裝上下文限制外掛程式,請執行下列指令:

ibmcloud plugin install cbr

在命令列中,當 ibmcloud CLI 和 cbr CLI 外掛程式有更新時,您會收到通知。 確保您的 CLI 保持更新,以便您可以使用所有可用的指令和旗標。

如果您要檢視 cbr CLI 外掛程式的目前版本,請執行 ibmcloud plugin list

區域

網路區域上的作業。

ibmcloud cbr zone-create

此作業會為指定的帳戶建立網路區域。

ibmcloud cbr zone-create [--name NAME] [--description DESCRIPTION] [--addresses ADDRESSES] [--vpc VPC] [--service-ref SERVICEREF] [--excluded EXCLUDED] [--empty-address-list] [--file FILE]

範例

ibmcloud cbr zone-create --name example-zone --description "Example zone description" --addresses 192.0.2.1,3ffe:1900:fe21:4545::,192.2.3.5-192.2.3.10,3ffe:1900:fe21:4547::-3ffe:1900:fe21:6767:

ibmcloud cbr zone-create --name example-zone-with-service-ref --service-ref service_name=kms,location=us-south

ibmcloud cbr zone-create --name example-zone-with-vpc --vpc crn:v1:staging:public:is:us-south:a/12ab34cd56ef78ab90cd12ef34ab56cd::vpc:r123-abc456de-f789-abc1-23de-f456abc789ab

輸出範例

id                    9adc34f2867a43452a517b3c2de78b95
crn                   crn:v1:bluemix:public:cbr:global:a/0123456789::zone:9adc34f2867a43452a517b3c2de78b95
address_count         7
excluded_count        0
name                  test
account_id            0123456789
description
Addresses             1 IP Address, 1 IP Range, 1 Subnet, 2 VPCs, 2 Service References
Excluded              No addresses
href                  https://cbr.cloud.ibm.com/v1/zones/9adc34f2867a43452a517b3c2de78b95
created_at            2024-03-06T22:20:25.000Z
created_by_id         iam-ServiceId-0123456789
last_modified_at      2024-03-06T22:20:25.000Z
last_modified_by_id   iam-ServiceId-0123456789

指令選項

--name (字串)
區域的名稱。
--description (字串)
區域的描述。
--addresses (字串)
區域中的位址清單。 僅限類型地址 ipAddress, ipRange,和 subnet 允許採用逗號分隔格式。 支援 IPv4 和 IPv6。
--service-ref (字串)
區域中的服務參照。 以 service_name=VALUE,service_name=VALUE,... 格式輸入。
若要尋找可用服務參照的清單,請執行 ibmcloud cbr service-ref-targets 指令
--vpc (字串)
區域中容許的 VPC。 以 value,value,... 格式輸入。
--excluded (字串)
區域中已排除位址的清單。 僅限類型地址 ipAddress, ipRange,和 subnet 允許採用逗號分隔格式。
--empty-address-list(布爾)
明確指定該區域將沒有位址。 這不能與 addresses, service-ref, vpc,或者 excluded 旗幟。
--file (字串)
所提供的檔案用來建立區域。 此旗標是唯一的,且無法與其他旗標一起使用。 檔案需要遵循區域建立 API 的 JSON 綱目。 如需相關資訊,請參閱 環境定義型限制 API

ibmcloud cbr zones

此作業會列出指定帳戶中的網路區域。

ibmcloud cbr zones [--name NAME] [--sort SORT]

範例

ibmcloud cbr zones

輸出範例

id                                 name      address_count   excluded_count
9adc34f2867a43452a517b3c2de78b95   test      7               0
12ab34cd56ef78ab90cd12ef34ab56cd   example   2               0

指令選項

--name (字串)
區域的名稱。
--sort (字串)
使用有效的排序欄位來排序結果。 若要進一步瞭解,請參閱 排序

ibmcloud cbr zone

此作業會擷取由指定區域 ID 識別的網路區域。

ibmcloud cbr zone ZONE-ID

範例

ibmcloud cbr zone 9adc34f2867a43452a517b3c2de78b95

輸出範例

id                    9adc34f2867a43452a517b3c2de78b95
crn                   crn:v1:bluemix:public:cbr:global:a/0123456789::zone:9adc34f2867a43452a517b3c2de78b95
address_count         7
excluded_count        0
name                  test
account_id            0123456789
description
Addresses             1 IP Address, 1 IP Range, 1 Subnet, 2 VPCs, 2 Service References
Excluded              No addresses
href                  https://cbr.cloud.ibm.com/v1/zones/9adc34f2867a43452a517b3c2de78b95
created_at            2024-03-06T22:20:25.000Z
created_by_id         iam-ServiceId-0123456789
last_modified_at      2024-03-06T22:20:25.000Z
last_modified_by_id   iam-ServiceId-0123456789

ibmcloud cbr zone-update

這項作業會取代指定區域 ID 所識別的網路區域。 不支援局部更新,並取代整個網路區域物件。

ibmcloud cbr zone-update ZONE-ID [--name NAME] [--description DESCRIPTION] [--addresses ADDRESSES] [--vpc VPC] [--service-ref SERVICEREF] [--excluded EXCLUDED] [--empty-address-list] [--file FILE]

範例

ibmcloud cbr zone-update 9adc34f2867a43452a517b3c2de78b95 --name 'Example Zone Name' --addresses 166.22.23.0-166.22.23.108,3ffe:1900:fe21:4545:: --excluded 166.22.23.100

ibmcloud cbr zone-update 9adc34f2867a43452a517b3c2de78b95 --name example-zone-with-service-ref --service-ref service_name=kms,location=us-south

ibmcloud cbr zone-update 9adc34f2867a43452a517b3c2de78b95 --name example-zone-with-vpc --vpc crn:v1:staging:public:is:us-south:a/12ab34cd56ef78ab90cd12ef34ab56cd::vpc:r123-abc456de-f789-abc1-23de-f456abc789ab

輸出範例

id                    9adc34f2867a43452a517b3c2de78b95
crn                   crn:v1:bluemix:public:cbr:global:a/0123456789::zone:9adc34f2867a43452a517b3c2de78b95
address_count         7
excluded_count        0
name                  test update
account_id            0123456789
description
Addresses             1 IP Address, 1 IP Range, 1 Subnet, 2 VPCs, 2 Service References
Excluded              No addresses
href                  https://cbr.cloud.ibm.com/v1/zones/9adc34f2867a43452a517b3c2de78b95
created_at            2024-03-06T22:20:25.000Z
created_by_id         iam-ServiceId-0123456789
last_modified_at      2024-03-06T22:29:19.000Z
last_modified_by_id   iam-ServiceId-0123456789

指令選項

--name (字串)
區域的名稱。
--description (字串)
區域的描述。
--addresses (字串)
區域中的位址清單。 僅限類型地址 ipAddress, ipRange,和 subnet 允許採用逗號分隔格式。 支援 IPv4 和 IPv6。
--service-ref (字串)
區域中的服務參照。 以 name=value,name=value,... 格式輸入。
--vpc (字串)
區域中容許的 VPC。 以 value,value,... 格式輸入。
--excluded (字串)
區域中已排除位址的清單。 僅限類型地址 ipAddress, ipRange,和 subnet 允許採用逗號分隔格式。
--empty-address-list(布爾)
明確指定該區域將沒有位址。 這不能與 addresses, service-ref, vpc,或者 excluded 旗幟。
--file (字串)
所提供的檔案用來更新區域。 此旗標是唯一的,且無法與其他旗標一起使用。 檔案需要遵循區域更新 API 的 JSON 綱目。 如需相關資訊,請參閱 環境定義型限制 API

ibmcloud cbr zone-patch

此操作對由指定區域 ID 識別的網路區域執行部分更新。

ibmcloud cbr zone-patch ZONE-ID [--name NAME] [--description DESCRIPTION]

範例

ibmcloud cbr zone-patch 9adc34f2867a43452a517b3c2de78b95 --name 'Example Zone Name' --description updated

輸出範例

id                    9adc34f2867a43452a517b3c2de78b95
crn                   crn:v1:bluemix:public:cbr:global:a/0123456789::zone:9adc34f2867a43452a517b3c2de78b95
address_count         7
excluded_count        0
name                  test update
account_id            0123456789
description           updated
Addresses             1 IP Address, 1 IP Range, 1 Subnet, 2 VPCs, 2 Service References
Excluded              No addresses
href                  https://cbr.cloud.ibm.com/v1/zones/9adc34f2867a43452a517b3c2de78b95
created_at            2024-03-06T22:20:25.000Z
created_by_id         iam-ServiceId-0123456789
last_modified_at      2024-03-06T22:29:19.000Z
last_modified_by_id   iam-ServiceId-0123456789

指令選項

--name (字串)
區域的名稱。
--description (字串)
區域的描述。

ibmcloud cbr zone-delete

這項作業會刪除指定區域 ID 所識別的網路區域。

ibmcloud cbr zone-delete ZONE-ID

範例

ibmcloud cbr zone-delete 65810ac762004f22ac19f8f8edf70a34

ibmcloud cbr service-ref-targets

這項作業會列出所有可用的服務參照目標。

ibmcloud cbr service-ref-targets [--type TYPE]

範例

ibmcloud cbr service-ref-targets

輸出範例

service_name                   service_type       locations
ace                            -                  -
apprapp                        -                  na, us, dal
apprapp-dev                    -                  na, us, dal
cloud-object-storage           -                  na, us, sjc
cloudantnosqldb                -                  ap, au, syd, +27
codeengine                     -                  ap, au, syd, +6
compliance                     platform_service   na, us, dal, +1
containers-kubernetes          -                  na, us, dal
directlink                     -                  -
event-notifications            -                  na, us, dal
globalcatalog-collection       -                  -
iam-groups                     platform_service   -
is                             -                  eu, es, mad, +4
kms                            -                  -
logdna                         -                  ap, au, syd, +17
logdnaat                       -                  ap, au, syd, +17
messagehub                     -                  eu, uk, lon, +3
messagehub-vnext-integration   -                  eu, uk, lon, +3
schematics                     -                  eu, de, fra, +6
secrets-manager                -                  -
server-protect                 -                  eu, es, mad, +4
sysdig-monitor                 -                  eu, uk, lon, +3
sysdig-secure                  -                  eu, uk, lon, +3
toolchain                      -                  ap, au, syd, +6
user-management                platform_service   -

指令選項

--type (字串)
指定要擷取的服務類型。 預設值為 all。 容許值為: allplatform_service

ibmcloud cbr service-ref-target

這項作業會取得指定服務名稱的服務參照目標。

ibmcloud cbr service-ref-target SERVICE-NAME

範例

ibmcloud cbr service-ref-target compliance

輸出範例

Service Name     compliance
Service Type:    platform_service
Locations:
                 Name               Display Name    Kind
                 na                 North America   geography
                 us                 United States   country
                 dal                Dallas          metro
                 wdc                Washington DC   metro

規則

環境定義型限制規則的作業。

ibmcloud cbr rule-create

這項作業會為指定的帳戶建立規則。

ibmcloud cbr rule-create [--description DESCRIPTION] [--resource-attributes RESOURCES] [--context-attributes CONTEXTS] [--api-types API-TYPES] [--enforcement-mode ENFORCEMENT-MODE] [--service-name SERVICE-NAME] [--service-group-id SERVICE-GROUP-ID] [--service-instance SERVICE-INSTANCE] [--region REGION] [--resource-type RESOURCE-TYPE] [--resource RESOURCE] [--resource-group-id RESOURCE-GROUP-ID] [--tags TAGS] [--zone-id ZONE-ID] [--empty-context-list] [--file FILE]

範例

ibmcloud cbr rule-create --description 'Example Rule Description' --service-name kms --context-attributes endpointType=private --zone-id 93de8d3f588ab2c457ff576c364d1145

ibmcloud cbr rule-create --service-name example-service --context-attributes mfa=LEVEL2,endpointType=public,networkZoneId=12ab34cd56ef78ab90cd12ef34ab56cd

輸出範例

id                    2c54cb0fefb0050c88f72d68c400fbec
crn                   crn:v1:bluemix:public:cbr:global:a/0123456789::rule:2c54cb0fefb0050c88f72d68c400fbec
description           test
operations            1 API Type
contexts              1 Context
resources
                      serviceInstance   1234567891234
                      serviceName       cloud-object-storage

href                  https://cbr.cloud.ibm.com/v1/rules/2c54cb0fefb0050c88f72d68c400fbec
created_at            2024-03-07T15:36:52.000Z
created_by_id         iam-ServiceId-0123456789
last_modified_at      2024-03-07T15:36:52.000Z
last_modified_by_id   iam-ServiceId-0123456789
enforcement_mode      enabled

指令選項

--description (字串)
規則的說明
--resource-attributes (字串)
name=value,name=value,... 形式套用此規則的資源屬性。 屬性運算符號只能改用 '--file' 標誌指定。
--context-attributes (字串)
此規則套用至的環境定義屬性,格式為 name=value,name=value,...
--api-types (字串)
規則適用的 API。 對於支援的服務 API 類型,請使用 service 對資源的命令。
--enforcement-mode (字串)
如何施行規則。 CLI 接受值 enabled (預設值)、disabledreport。 有關強制執行的更多信息,請參閱 規則強制執行
--service-name (字串)
建立 IBM Cloud 資源屬性 serviceName 的速記。
--service-group-id (字串)
service_group_id 資源屬性。
--service-instance (字串)
服務實例的 GUID。 此選項與 --file 選項是排他的。
--region (字串)
建立 IBM Cloud 資源屬性 region 的速記。 對於支援的地區,請執行 ibmcloud regions
--resource-type (字串)
建立 IBM Cloud 資源屬性 resourceType 的速記。
--resource (字串)
建立 IBM Cloud 資源屬性 resource 的速記。
--resource-group-id (字串)
建立 IBM Cloud 資源屬性 resourceGroupId 的速記。
--tags (字串)
資源的存取標籤,格式為 name:value,name:value,...
--zone-id (字串)
將環境定義屬性 networkZoneId 新增至第一個環境定義的速記。
--empty-context-list(布爾)
明確指定該規則將沒有上下文。 這不能與 context-attributes 或者 zone-id 旗幟。
--file (字串)
所提供的檔案用來建立規則。 此旗標是唯一的,且無法與其他旗標一起使用。 檔案需要遵循規則建立 API 的 JSON 綱目。 如需相關資訊,請參閱 環境定義型限制 API

ibmcloud cbr rules

此作業會列出指定帳戶中的規則。

ibmcloud cbr rules [--enforcement-mode ENFORCEMENT-MODE] [--service-name SERVICE-NAME] [--service-group-id SERVICE-GROUP-ID] [--service-instance SERVICE-INSTANCE] [--region REGION] [--resource-type RESOURCE-TYPE] [--resource RESOURCE] [--zone-id ZONE-ID] [--sort SORT]

範例

ibmcloud cbr rules

輸出範例

id                                 service_name           enforcement   description
2c54cb0fefb0050c88f72d68c400fbec   cloud-object-storage   enabled       test
a4135a90bb507bf6d96cf4c6f009d151   kms                    disabled       example

指令選項

--enforcement-mode (字串)
如何施行規則。 CLI 接受值 enabled (預設值)、disabledreport。 有關強制執行的更多信息,請參閱 規則強制執行
--region (字串)
region 資源屬性。
--resource (字串)
resource 資源屬性。
--resource-type (字串)
resourceType 資源屬性。
--service-instance (字串)
服務實體的 GUID。
--service-name (字串)
serviceName 資源屬性。
--service-group-id (字串)
service_group_id 資源屬性。
--zone-id (字串)
區域的全球唯一 ID。
--sort (字串)
使用有效的排序欄位來排序結果。 若要進一步瞭解,請參閱 排序

ibmcloud cbr rule

此作業會擷取由指定規則 ID 識別的規則。

ibmcloud cbr rule RULE-ID

範例

ibmcloud cbr rule 30fd58c9b75f40e854b89c432318b4a2

輸出範例

id                    2c54cb0fefb0050c88f72d68c400fbec
crn                   crn:v1:bluemix:public:cbr:global:a/0123456789::rule:2c54cb0fefb0050c88f72d68c400fbec
description           test
operations            1 API Type
contexts              1 Context
resources
                      serviceInstance   1234567891234
                      serviceName       cloud-object-storage

href                  https://cbr.cloud.ibm.com/v1/rules/2c54cb0fefb0050c88f72d68c400fbec
created_at            2024-03-07T15:36:52.000Z
created_by_id         iam-ServiceId-0123456789
last_modified_at      2024-03-07T15:36:52.000Z
last_modified_by_id   iam-ServiceId-0123456789
enforcement_mode      enabled

ibmcloud cbr rule-update

這項作業會取代指定規則 ID 所識別的規則。 不支援局部更新,且會取代整個規則物件。

ibmcloud cbr rule-update RULE-ID [--description DESCRIPTION] [--resource-attributes RESOURCES] [--context-attributes CONTEXTS] [--api-types API-TYPES] [--enforcement-mode ENFORCEMENT-MODE] [--service-name SERVICE-NAME] [--service-instance SERVICE-INSTANCE] [--region REGION] [--resource-type RESOURCE-TYPE] [--resource RESOURCE] [--resource-group-id RESOURCE-GROUP-ID] [--tags TAGS] [--zone-id ZONE-ID] [--empty-context-list] [--file FILE]

範例

ibmcloud cbr rule-update 30fd58c9b75f40e854b89c432318b4a2 --description 'Example rule description' --service-name kms --context-attributes endpointType=private --zone-id 93de8d3f588ab2c457ff576c364d1145

輸出範例

id                    2c54cb0fefb0050c88f72d68c400fbec
crn                   crn:v1:bluemix:public:cbr:global:a/0123456789::rule:2c54cb0fefb0050c88f72d68c400fbec
description           updated
operations            1 API Type
contexts              1 Context
resources
                      serviceInstance   1234567891234
                      serviceName       cloud-object-storage

href                  https://cbr.cloud.ibm.com/v1/rules/2c54cb0fefb0050c88f72d68c400fbec
created_at            2024-03-07T15:36:52.000Z
created_by_id         iam-ServiceId-0123456789
last_modified_at      2024-03-07T15:41:18.000Z
last_modified_by_id   iam-ServiceId-0123456789
enforcement_mode      enabled

指令選項

--description (字串)
規則的說明
--resource-attributes (字串)
name=value,name=value,... 形式套用此規則的資源屬性。 屬性運算符號只能改用 '--file' 標誌指定。
--context-attributes (字串)
此規則套用至的環境定義屬性,格式為 name=value,name=value,...
--api-types (字串)
規則適用的 API。 對於支援的服務 API 類型,請使用 service 對資源的命令。
--enforcement-mode (字串)
如何施行規則。 CLI 接受值 enabled (預設值)、disabledreport。 有關強制執行的更多信息,請參閱 規則強制執行
--service-name (字串)
建立 IBM Cloud 資源屬性 serviceName 的速記。
--service-group-id (字串)
service_group_id 資源屬性。
--service-instance (字串)
服務實例的 GUID。 此選項與 --file 選項是排他的。
--region (字串)
建立 IBM Cloud 資源屬性 region 的速記。 對於支援的地區,請執行 ibmcloud regions
--resource-type (字串)
建立 IBM Cloud 資源屬性 resourceType 的速記。
--resource (字串)
建立 IBM Cloud 資源屬性 resource 的速記。
--resource-group-id (字串)
建立 IBM Cloud 資源屬性 resourceGroupId 的速記。
--tags (字串)
資源的存取標籤,格式為 name:value,name:value,...
--zone-id (字串)
將環境定義屬性 networkZoneId 新增至第一個環境定義的速記。
--empty-context-list(布爾)
明確指定該規則將沒有上下文。 這不能與 context-attributes 或者 zone-id 旗幟。
--file (字串)
所提供的檔案用來建立規則。 此旗標是唯一的,且無法與其他旗標一起使用。 檔案需要遵循規則建立 API 的 JSON 綱目。 如需相關資訊,請參閱 環境定義型限制 API

ibmcloud cbr rule-patch

此操作執行由指定規則 ID 標識的規則的部分更新。

ibmcloud cbr rule-patch RULE-ID [--description DESCRIPTION] [--enforcement-mode ENFORCEMENT-MODE]

範例

ibmcloud cbr rule-patch 30fd58c9b75f40e854b89c432318b4a2 --description 'Example rule description' --enforcement-mode disabled

輸出範例

id                    2c54cb0fefb0050c88f72d68c400fbec
crn                   crn:v1:bluemix:public:cbr:global:a/0123456789::rule:2c54cb0fefb0050c88f72d68c400fbec
description           updated
operations            1 API Type
contexts              1 Context
resources
                      serviceInstance   1234567891234
                      serviceName       cloud-object-storage

href                  https://cbr.cloud.ibm.com/v1/rules/2c54cb0fefb0050c88f72d68c400fbec
created_at            2024-03-07T15:36:52.000Z
created_by_id         iam-ServiceId-0123456789
last_modified_at      2024-03-07T15:41:18.000Z
last_modified_by_id   iam-ServiceId-0123456789
enforcement_mode      enabled

指令選項

--description (字串)
規則的說明
--enforcement-mode (字串)
如何施行規則。 CLI 接受值 enabled (預設值)、disabledreport。 有關強制執行的更多信息,請參閱 規則強制執行

ibmcloud cbr rule-delete

這項作業會刪除指定規則 ID 所識別的規則。

ibmcloud cbr rule-delete RULE-ID

範例

ibmcloud cbr rule-delete 30fd58c9b75f40e854b89c432318b4a2

服務

ibmcloud cbr services

此操作列出可建立基於上下文限制規則的服務。

ibmcloud cbr services

範例

ibmcloud cbr services

輸出範例

Display Name                                         Name                          API Types
Activity Tracker Event Routing                       atracker                      1 API Type
All IAM Account Management Services                  IAM                           3 API Types
App Configuration                                    apprapp                       3 API Types
Catalog Management                                   globalcatalog-collection      3 API Types
Cloud Activity Tracker                               logdnaat                      3 API Types
Cloud Logs                                           logs                          1 API Type
Cloud Monitoring                                     sysdig-monitor                1 API Type
Cloud Object Storage                                 cloud-object-storage          1 API Type
Code Engine                                          codeengine                    3 API Types
Container Registry                                   container-registry            1 API Type
Context-Based Restrictions                           context-based-restrictions    1 API Type
Databases for EDB                                    databases-for-enterprisedb    3 API Types
Databases for Elasticsearch                          databases-for-elasticsearch   3 API Types
Databases for etcd                                   databases-for-etcd            3 API Types
Databases for MongoDB                                databases-for-mongodb         3 API Types
Databases for MySQL                                  databases-for-mysql           3 API Types
Databases for PostgreSQL                             databases-for-postgresql      3 API Types
Databases for Redis                                  databases-for-redis           3 API Types
Direct Link                                          directlink                    1 API Type
DNS Services                                         dns-svcs                      3 API Types
Event Notifications                                  event-notifications           5 API Types
Event Streams                                        messagehub                    1 API Type
Hyper Protect Crypto Services                        hs-crypto                     3 API Types
IAM Access Groups Service                            iam-groups                    1 API Type
IAM Access Management Service                        iam-access-management         1 API Type
IAM Identity Service                                 iam-identity                  3 API Types
Key Protect                                          kms                           3 API Types
Kubernetes Service                                   containers-kubernetes         3 API Types
Log Analysis                                         logdna                        3 API Types
Messages for RabbitMQ                                messages-for-rabbitmq         3 API Types
MQ                                                   mqcloud                       2 API Types
Schematics                                           schematics                    1 API Type
Secrets Manager                                      secrets-manager               3 API Types
Security and Compliance Center                       compliance                    3 API Types
Security and Compliance Center Workload Protection   sysdig-secure                 1 API Type
Tagging Service                                      ghost-tags                    1 API Type
Transit Gateway                                      transit                       1 API Type
User Management                                      user-management               1 API Type
VPC Infrastructure Services                          is                            1 API Type

ibmcloud cbr service

此作業擷取可建立基於上下文限制規則的服務。 使用 JSON 或 YAML 輸出進行查詢時,您可以檢視每個 API 類型的完整動作清單。

ibmcloud cbr service SERVICE [--resource-type RESOURCE-TYPE]

範例

ibmcloud cbr service context-based-restrictions

輸出範例

Display Name:     Context-Based Restrictions
Service Name:     context-based-restrictions
API Types:
                  Name   API Type ID                                                     Type      Actions      Description
                  All    crn:v1:bluemix:public:context-based-restrictions::::api-type:   service   10 actions   Protects all service APIs.
Resource Types:
                  rule
                  zone

指令選項

--resource-type (字串)
服務的子資源,具有額外的基於上下文的限制規則設定。 請注意,並非所有服務都有額外的子資源設定。

ibmcloud cbr rule-options

此作業可取得服務的規則選項,該服務可建立基於上下文的限制規則。

ibmcloud cbr rule-options SERVICE [--api-types API-TYPES] [--resource-type RESOURCE-TYPE] [--full]

範例

ibmcloud cbr rule-options context-based-restrictions --api-types crn:v1:bluemix:public:context-based-restrictions::::api-type: --full

輸出範例

Operations:
                       API Types:
                                     crn:v1:bluemix:public:context-based-restrictions::::api-type:

Enforcement Modes:     disabled, enabled, report
Context Attributes:
                       endpointType
                          values:
                                     private
                                     public
                       mfa
                          values:
                                     IAM_ACCOUNT_SETTING
                                     LEVEL1
                                     LEVEL2
                                     LEVEL3
                       networkZoneId
Resource Attributes:
                       accountId
                       resourceGroupId
                       resourceType
                          values:
                                     rule
                                     zone
                       serviceName
                          values:
                                     context-based-restrictions

指令選項

--api-types (字串)
規則適用的 API 類型。 可以逗號分隔的清單傳送多個。 如果未指定,則預設為保護所有以 ' crn:v1:bluemix:public:context-based-restrictions::::api-type: ' 表示的服務 API。
--resource-type (字串)
服務的子資源,具有額外的基於上下文的限制規則設定。 請注意,並非所有服務都有額外的子資源設定。
--full(布爾)
為選項提供更詳細的輸出,例如有效的屬性值和屬性運算符號。 如果沒有列出屬性運算符號,則默認支援 stringEquals 運算符號。

ibmcloud cbr api-types 已停用

這個指令已淘汰。 改用 ibmcloud cbr service 來取得 API 類型。

[已廢棄]此操作會列出所有可用的 API 類型。 此作業已不再適用,建議改用 service 指令。

ibmcloud cbr api-types {--service-name SERVICE-NAME | --service-group-id SERVICE-GROUP-ID} [--resource-type RESOURCE-TYPE]

範例

ibmcloud cbr api-types --service-name context-based-restrictions

輸出範例

api_type_id                                                     display_name   type      description                  enforcement_modes           actions
crn:v1:bluemix:public:context-based-restrictions::::api-type:   All            service   Protects all service APIs.   disabled, enabled, report   10 actions

指令選項

--service-name (字串)
指定要查詢 API 類型的服務。
--resource-type (字串)
服務的資源類型。
--service-group-id (字串)
指定要查詢 API 類型的服務群組。