コンテキストに基づく制限の管理

ルールの目的を特定するのに役立つ説明を更新したり、リソースやネットワーク環境の新しいリストを選択したりすることで、いつでもコンテキストルールを管理できます。 また、コンテキストベースの制限を削除して、ルール内のコンテキストで定義された制限を削除することもできる。

コンテキストベースの制限は、自身の IBM Cloud® リソースに対するアクセス制限を定義し、実施することができる。 ネットワーク・ゾーンやエンドポイント・タイプなどのコンテキストに基づいて、これらの制限を定義することができます。 詳しくは、コンテキスト・ベースの制限とはを参照してください。

コンテキストベースの制限サービスはルールとネットワークゾーンを管理するため、コンテキストベースの制限サービスのルールを満たすことができないと、これらのリソースを管理するすべての能力を失う可能性があります。 このようなルールの作成または更新の試みは、リクエストのコンテキストが新 規または修正されたルールを満たす場合にのみ許可される。

コンテキストベースの制限サービスを対象とするルールを満たすことができなくなった場合は、 サポートケースを 開き、アクセスを回復するために満たすことができるコンテキストを提示してください。

開始前に

コンテキストベースの制限を管理するには、 アカウント管理サービスの管理者ロールが割り当てられている必要があります。

コンソールを使ってルールを更新する

クラウドリソースのコンテキストベースの制限を編集するには、以下の手順を実行します:

  1. IBM Cloud コンソールで管理>**コンテキスト・ベースの制限 (Context-based restrictions)**をクリックし、ルールを選択します。
  2. 更新したいルールの [Actions] アイコン Edit ]を選択します。
  3. ルールによって操作が制限されるAPIの範囲を更新するには、[ すべてのAPI ]または[ 特定のAPI] を選択します。 次に **「適用」または「続行」**をクリックします。
  4. 制限の対象となるリソースの範囲を更新するには、リソースグループや場所などの利用可能な属性に基づいて、[ すべてのリソース ]または[ 特定のリソース ]を選択できます。 次に **「適用」または「続行」**をクリックします。
  5. 既存のコンテキストを更新するには、サマリーパネルの Edit アイコン クリックする。
    1. 許可されるエンドポイントタイプを更新する。
      • すべてのサービスがサポートするエンドポイントタイプを許可するには、トグルを「No」に設定します。
      • 特定のエンドポイント・タイプのみを許可するには、トグルを「Yes」に設定する。
    2. ニューワーク・ゾーンを更新する。 新しいネットワークゾーンを選択したり、ネットワークゾーンの選択を解除して削除することができます。
  6. その後、 Applyをクリックする。
  7. 削除アイコンをクリックする コンテキストを削除するには、サマリーパネルの クリックする。
  8. すべてのエンドポイントまたは特定のエンドポイントを選択し、ネットワーク・ゾーンを選択して、新規コンテキストを構成します。 次に、**「追加」**をクリックします。
  9. Apply または Continueをクリックします。
  10. ルールの新しい説明を入力します。 Apply をクリックして説明を更新するか、 Continue をクリックします。
  11. ルールの施行を更新するには、 Edit アイコン Editアイコン クリックする。 ルールを有効無効、またはレポートのみに設定することができます。
  12. **「適用」**をクリックして完了します。

CLIを使用したルールの更新

クラウド・リソースのコンテキスト・ベースの制限を更新するには、ibmcloud cbr rule-update コマンドを使用します。 次の例は、ID 30fd58c9b75f40e854b89c432318b4a2 を持つルールの説明、許可されるエンドポイントタイプ、およびネットワークゾーンを更新します。

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

APIを使用したルールの更新

ルールを作成してクラウドリソースの制限を更新するには、 Context-based restrictions APIを 呼び出します。

  1. 交換したい ルールを入手する。 レスポンスボディにはルールIDをコピーし、レスポンスヘッダにはETagヘッダをコピーする。

    curl -X GET --location --header "Authorization: Bearer {iam_token}" --header "Accept: application/json" "https://cbr.cloud.ibm.com/v1/rules/{rule_id}"
    
    GetRuleOptions getRuleOptions = new GetRuleOptions.Builder()
    .ruleId(ruleID)
    .build();
    Response<Rule> response = contextBasedRestrictionsService.getRule(getRuleOptions).execute();
    Rule rule = response.getResult();
    System.out.println(rule);
    
    const params = {
      ruleId,
    };
    try {
      const res = await contextBasedRestrictionsService.getRule(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
    
    rule = context_based_restrictions_service.get_rule(
      rule_id=rule_id
    )
    rule = rule.get_result()
    print(json.dumps(rule, indent=2))
    
    getRuleOptions := contextBasedRestrictionsService.NewGetRuleOptions(
      ruleID,
    )
    rule, response, err := contextBasedRestrictionsService.GetRule(getRuleOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(rule, "", "  ")
    fmt.Println(string(b))
    
  2. 次の例は、ルールを更新されたバージョンに置き換える。 ETag値はreplaceリクエストの If-Match ヘッダーで必要とされる。

    curl -X PUT --location --header "Authorization: Bearer {iam_token}" --header "Accept: application/json" --header "If-Match: {if_match}" --header "Content-Type: application/json" --data '{ "description": "this is an example of rule", "resources": [ { "attributes": [ { "name": "accountId", "value": "12ab34cd56ef78ab90cd12ef34ab56cd" }, { "name": "serviceName", "value": "kms" } ] } ], "contexts": [ { "attributes": [ { "name": "networkZoneId", "value": "76921bd873115033bd2a0909fe081b45" } ] } ], "enforcement_mode": "disabled" }' "{base_url}/v1/rules/{rule_id}"
    
    RuleContextAttribute ruleContextAttributeModel = new RuleContextAttribute.Builder()
      .name("networkZoneId")
      .value("76921bd873115033bd2a0909fe081b45")
      .build();
    RuleContext ruleContextModel = new RuleContext.Builder()
      .attributes(new java.util.ArrayList<RuleContextAttribute>(java.util.Arrays.asList(ruleContextAttributeModel)))
      .build();
    ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder()
      .name("accountId")
      .value("12ab34cd56ef78ab90cd12ef34ab56cd")
      .build();
    Resource resourceModel = new Resource.Builder()
      .attributes(new java.util.ArrayList<ResourceAttribute>(java.util.Arrays.asList(resourceAttributeModel)))
      .build();
    ReplaceRuleOptions replaceRuleOptions = new ReplaceRuleOptions.Builder()
      .ruleId("testString")
      .ifMatch("testString")
      .description("this is an example of rule")
      .enforcementMode("disabled")
      .contexts(new java.util.ArrayList<RuleContext>(java.util.Arrays.asList(ruleContextModel)))
      .resources(new java.util.ArrayList<Resource>(java.util.Arrays.asList(resourceModel)))
      .build();
    Response<OutRule> response = contextBasedRestrictionsService.replaceRule(replaceRuleOptions).execute();
    OutRule outRule = response.getResult();
    System.out.println(outRule);
    
    // Request models needed by this operation.
    // RuleContextAttribute
    const ruleContextAttributeModel = {
      name: 'networkZoneId',
      value: '76921bd873115033bd2a0909fe081b45',
    };
    // RuleContext
    const ruleContextModel = {
      attributes: [ruleContextAttributeModel],
    };
    // ResourceAttribute
    const resourceAttributeModel = {
      name: 'accountId',
      value: '12ab34cd56ef78ab90cd12ef34ab56cd',
    };
    // Resource
    const resourceModel = {
      attributes: [resourceAttributeModel],
    };
    const params = {
      ruleId: 'testString',
      ifMatch: 'testString',
      contexts: [ruleContextModel],
      resources: [resourceModel],
      description: 'this is an example of rule',
      enforcementMode: 'disabled',
    };
    contextBasedRestrictionsService.replaceRule(params)
      .then(res => {
        console.log(JSON.stringify(res.result, null, 2));
      })
      .catch(err => {
        console.warn(err)
      });
    
    rule_context_attribute_model = {
      'name': 'networkZoneId',
      'value': '76921bd873115033bd2a0909fe081b45',
    }
    rule_context_model = {
      'attributes': [rule_context_attribute_model],
    }
    resource_attribute_model = {
      'name': 'accountId',
      'value': '12ab34cd56ef78ab90cd12ef34ab56cd',
    }
    resource_model = {
      'attributes': [resource_attribute_model],
    }
    out_rule = context_based_restrictions_service.replace_rule(
      rule_id='testString',
      if_match='testString',
      contexts=[rule_context_model],
      resources=[resource_model],
      description='this is an example of rule',
      enforcement_mode='disabled'
    ).get_result()
    print(json.dumps(out_rule, indent=2))
    
    ruleContextAttributeModel := &contextbasedrestrictionsv1.RuleContextAttribute{
      Name: core.StringPtr("networkZoneId"),
      Value: core.StringPtr("76921bd873115033bd2a0909fe081b45"),
    }
    ruleContextModel := &contextbasedrestrictionsv1.RuleContext{
      Attributes: []contextbasedrestrictionsv1.RuleContextAttribute{*ruleContextAttributeModel},
    }
    resourceAttributeModel := &contextbasedrestrictionsv1.ResourceAttribute{
      Name: core.StringPtr("accountId"),
      Value: core.StringPtr("12ab34cd56ef78ab90cd12ef34ab56cd"),
    }
    resourceModel := &contextbasedrestrictionsv1.Resource{
      Attributes: []contextbasedrestrictionsv1.ResourceAttribute{*resourceAttributeModel},
    }
    replaceRuleOptions := contextBasedRestrictionsService.NewReplaceRuleOptions(
      "testString",
      "testString",
    )
    replaceRuleOptions.SetDescription("this is an example of rule")
    replaceRuleOptions.SetContexts([]contextbasedrestrictionsv1.RuleContext{*ruleContextModel})
    replaceRuleOptions.SetResources([]contextbasedrestrictionsv1.Resource{*resourceModel})
    replaceRuleOptions.SetEnforcementMode(contextbasedrestrictionsv1.ReplaceRuleOptionsEnforcementModeDisabledConst)
    outRule, response, err := contextBasedRestrictionsService.ReplaceRule(replaceRuleOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(outRule, "", "  ")
    fmt.Println(string(b))
    

コンソールを使ったネットワークゾーンの更新

アクセス要求を発信できる許可されたロケーションのリストを変更することができます。 1 つ以上のネットワーク・ロケーションのセットを、IP アドレス (個々のアドレス、アドレス範囲、またはサブネット)、VPC、またはサービス参照で指定できます。 ルールで使用されているネットワーク・ゾーンを更新するか、更新した新しいネットワーク・ゾーンを後からルールに統合することができます。

  1. IBM Cloud コンソールで**「管理」** > **「コンテキスト・ベースの制限 (Context-based restrictions)」をクリックし、「ネットワーク・ゾーン」**を選択します。
  2. 更新したいネットワークゾーンの 「Actions」 アイコン Edit 」を選択します。
  3. ゾーン名と説明を更新できます。
  4. アクセス要求を発信できる許可された IP アドレスのリストを編集できます。 必要に応じて、拒否リストに例外を含めます。
  5. 許可される VPC を追加または削除できます。
  6. サービス参照を追加または削除できます。 ネットワーク・ゾーンに関連付ける IP アドレスのサービスを選択します。
  7. 次へをクリックして新しい構成を確認します。
  8. 変更を適用するには、**「更新」**をクリックします。

CLIを使用したネットワーク・ゾーンの更新

ネットワークゾーンを更新するには、以下の手順を実行します。

  1. ibmcloud cbr zones コマンドを使用してアカウント内のすべてのゾーンを一覧表示し、更新するネットワークゾーンのゾーンIDを取得します。
    ibmcloud cbr zones
    
  2. ibmcloud cbr zone-update コマンドを使用して、ネットワーク・ゾーンを更新します。 以下の例は、IDが 65810ac762004f22ac19f8f8edf70a34 のネットワークゾーンのゾーン名、 許可アドレス、除外アドレスを更新する。
    ibmcloud cbr zone-update 65810ac762004f22ac19f8f8edf70a34 --name 'Example Zone Name' --addresses 166.22.23.0-166.22.23.108 --excluded 166.22.23.100
    

APIを使用したネットワークゾーンの更新

ネットワークゾーンを更新するには、以下の手順を実行します。

  1. 交換したい ゾーンを入手する。 応答本文ではゾーンIDをコピーし、応答ヘッダではETagヘッダをコピーする。

    curl -X GET --location --header "Authorization: Bearer {iam_token}" --header "Accept: application/json" "https://cbr.cloud.ibm.com/v1/zones/{zone_id}"
    
    GetZoneOptions getZoneOptions = new GetZoneOptions.Builder()
     .zoneId(zoneID)
     .build();
    Response<Zone> response = contextBasedRestrictionsService.getZone(getZoneOptions).execute();
    Zone zone = response.getResult();
    System.out.println(zone);
    
    const params = {
     zoneId,
    };
    try {
     const res = await contextBasedRestrictionsService.getZone(params);
     console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
     console.warn(err);
    }
    
    get_zone_response = context_based_restrictions_service.get_zone(
     zone_id=zone_id
    )
    zone = get_zone_response.get_result()
    print(json.dumps(zone, indent=2))
    
    getZoneOptions := contextBasedRestrictionsService.NewGetZoneOptions(
      zoneID,
    )
     zone, response, err := contextBasedRestrictionsService.GetZone(getZoneOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(zone, "", "  ")
    fmt.Println(string(b))
    
  2. [ゾーンの置換]](/apidocs/context-based-restrictions?code=go#replace-zone) を使用してネットワークゾーンを更新する。 ETag値はreplaceリクエストの If-Match ヘッダーで必要とされる。

    curl -X PUT --location --header "Authorization: Bearer {iam_token}" --header "Accept: application/json" --header "If-Match: {if_match}" --header "Content-Type: application/json" --data '{ "name": "new zone name", "description": "new zone description", "account_id": "12ab34cd56ef78ab90cd12ef34ab56cd", "addresses": [ { "type": "ipAddress", "value": "169.23.56.234" }, { "type": "ipRange", "value": "169.23.22.0-169.23.22.255" }, { "type": "vpc", "value": "crn:v1:bluemix:public:is:us-south:a/12ab34cd56ef78ab90cd12ef34ab56cd::vpc:r134-d98a1702-b39a-449a-86d4-ef8dbacf281e" } ] }' "{base_url}/v1/zones/{zone_id}"
    
    AddressIPAddress addressModel = new AddressIPAddress.Builder()
      .type("ipAddress")
      .value("169.23.56.234")
      .build();
    ReplaceZoneOptions replaceZoneOptions = new ReplaceZoneOptions.Builder()
      .zoneId("testString")
      .ifMatch("testString")
      .name("an example of zone")
      .accountId("12ab34cd56ef78ab90cd12ef34ab56cd")
      .description("this is an example of zone")
      .addresses(new java.util.ArrayList<Address>(java.util.Arrays.asList(addressModel)))
      .build();
    Response<OutZone> response = contextBasedRestrictionsService.replaceZone(replaceZoneOptions).execute();
    OutZone outZone = response.getResult();
    System.out.println(outZone);
    
    // Request models needed by this operation.
    // AddressIPAddress
    const addressModel = {
      type: 'ipAddress',
      value: '169.23.56.234',
    };
    const params = {
      zoneId: 'testString',
      ifMatch: 'testString',
      name: 'an example of zone',
      accountId: '12ab34cd56ef78ab90cd12ef34ab56cd',
      addresses: [addressModel],
      description: 'this is an example of zone',
    };
    contextBasedRestrictionsService.replaceZone(params)
      .then(res => {
        console.log(JSON.stringify(res.result, null, 2));
      })
      .catch(err => {
        console.warn(err)
      });
    
    address_model = {
      'type': 'ipAddress',
      'value': '169.23.56.234',
    }
    out_zone = context_based_restrictions_service.replace_zone(
      zone_id='testString',
      if_match='testString',
      name='an example of zone',
      account_id='12ab34cd56ef78ab90cd12ef34ab56cd',
      addresses=[address_model],
      description='this is an example of zone'
    ).get_result()
    print(json.dumps(out_zone, indent=2))
    
    addressModel := &contextbasedrestrictionsv1.AddressIPAddress{
      Type: core.StringPtr("ipAddress"),
      Value: core.StringPtr("169.23.56.234"),
    }
    replaceZoneOptions := contextBasedRestrictionsService.NewReplaceZoneOptions(
      "testString",
      "testString",
    )
    replaceZoneOptions.SetName("an example of zone")
    replaceZoneOptions.SetAccountID("12ab34cd56ef78ab90cd12ef34ab56cd")
    replaceZoneOptions.SetDescription("this is an example of updated zone")
    replaceZoneOptions.SetAddresses([]contextbasedrestrictionsv1.AddressIntf{addressModel})
    outZone, response, err := contextBasedRestrictionsService.ReplaceZone(replaceZoneOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(outZone, "", "  ")
    fmt.Println(string(b))
    

コンソールを使ってルールを削除する

ルールを削除すると、指定されたリソースからコンテキスト・ベースの制限が削除され、ユーザーが適切な権限を持っていれば、どのコンテキストからの要求でも許可されるようになります。 以下の手順を実行して、クラウド・リソースのルールを削除できます。

  1. IBM Cloud コンソールで**「管理」** > **「コンテキスト・ベースの制限 (Context-based restrictions)」に移動し、「ルール」**を選択します。
  2. ルールが含まれている行のアクション・アイコンアクション・アイコンをクリックし、削除をクリックします。

CLIを使用したルールの削除

以下の手順を実行して、クラウド・リソースのルールを削除できます。

  1. コンテキストベースの制限ルール コマンドを使用して、削除するルールのルールIDを取得します。 コマンド・オプションとして属性を指定することで、リストの結果を絞り込むことができる。
    ibmcloud cbr rules --serviceName "iam-identity"
    
  2. cbr rule-delete コマンドを使用して、指定されたルール ID のルールを削除します。
    ibmcloud cbr rule-delete 30fd58c9b75f40e854b89c432318b4a2
    

APIを使用したルールの削除

以下の手順を実行して、クラウド・リソースのルールを削除できます。

  1. context-based-restrictions list rules メソッドを使用して、削除するルールのルールIDを取得する。
    curl -X GET --location --header "Authorization: Bearer {iam_token}" --header "Accept: application/json" "{base_url}/v1/rules?account_id={account_id}"
    
    ListRulesOptions listRulesOptions = new ListRulesOptions.Builder()
    .accountId("testString")
    .build();
    
    Response<OutRulePage> response = contextBasedRestrictionsService.listRules(listRulesOptions).execute();
    OutRulePage outRulePage = response.getResult();
    
    System.out.println(outRulePage);
    
     const params = {
       accountId: 'testString',
     };
    
     contextBasedRestrictionsService.listRules(params)
       .then(res => {
         console.log(JSON.stringify(res.result, null, 2));
       })
       .catch(err => {
         console.warn(err)
       });
    
    out_rule_page = context_based_restrictions_service.list_rules(
       account_id='testString'
     ).get_result()
    
     print(json.dumps(out_rule_page, indent=2))
    
     listRulesOptions := contextBasedRestrictionsService.NewListRulesOptions(
       "testString",
     )
    
     ruleList, response, err := contextBasedRestrictionsService.ListRules(listRulesOptions)
     if err != nil {
       panic(err)
     }
     b, _ := json.MarshalIndent(ruleList, "", "  ")
     fmt.Println(string(b))
    
  2. 指定されたルール ID のルールを削除する。
    curl -X DELETE --location --header "Authorization: Bearer {iam_token}" "{base_url}/v1/rules/{rule_id}"
    
    DeleteRuleOptions deleteRuleOptions = new DeleteRuleOptions.Builder()
      .ruleId("testString")
      .build();
    
    Response<Void> response = contextBasedRestrictionsService.deleteRule(deleteRuleOptions).execute();
    
     const params = {
       ruleId: 'testString',
     };
    
     contextBasedRestrictionsService.deleteRule(params)
       .then(res => {
         done();
       })
       .catch(err => {
         console.warn(err)
       });
    
     response = context_based_restrictions_service.delete_rule(
       rule_id='testString'
     )
    
     deleteRuleOptions := contextBasedRestrictionsService.NewDeleteRuleOptions(
       "testString",
     )
    
     response, err := contextBasedRestrictionsService.DeleteRule(deleteRuleOptions)
     if err != nil {
       panic(err)
     }
     if response.StatusCode != 204 {
       fmt.Printf("\nUnexpected response status code received from DeleteRule(): %d\n", response.StatusCode)
     }
    

コンソールを使ってネットワークゾーンを削除する

ネットワーク・ゾーンを削除すると、アクセス要求が作成される、許可されたネットワーク・ロケーションのセットが削除されます。 ネットワーク・ゾーンがルールに追加されている場合は、まずそのゾーンをルールから削除する必要があります。 ネットワークゾーンを削除するには、以下の手順を実行する:

  1. IBM Cloud、「 Manage(管理) 」 > 「 Context-based restrictions(コンテキストベースの制限) 」と進み、「 Network zones(ネットワークゾーン) 」を選択する。
  2. ネットワーク・ゾーンを含む行のアクション・アイコン アクション・アイコンをクリックし、削除をクリックします。

CLIを使ったネットワーク・ゾーンの削除

ネットワーク・ゾーンを削除すると、アクセス要求が作成される、許可されたネットワーク・ロケーションのセットが削除されます。 ネットワーク・ゾーンがルールに追加されている場合は、まずそのゾーンをルールから削除する必要があります。 ルールからゾーンを削除する方法の詳細については、 コンテキストベースの制限を更新する を参照してください。 次に、以下の手順を実行します。

  1. contxt-based restrictions zones コマンドを使用して、削除するネットワーク・ゾーンのゾーンIDを取得します。 ゾーン名を指定することで、リストの結果を絞り込むことができる。
    ibmcloud cbr zones --name "Example zone"
    
  2. cbr zone-delete コマンドを使用して、指定されたゾーンIDのネットワークゾーンを削除します。
    ibmcloud cbr zone-delete 65810ac762004f22ac19f8f8edf70a34
    

APIを使用したネットワークゾーンの削除

ネットワーク・ゾーンを削除すると、アクセス要求が作成される、許可されたネットワーク・ロケーションのセットが削除されます。 ネットワーク・ゾーンがルールに追加されている場合は、まずそのゾーンをルールから削除する必要があります。 ルールからのゾーンの削除について詳しくは、コンテキスト・ベースの制限の更新を参照してください。 次に、以下の手順を実行します。

  1. コンテキストベースの制限リストゾーンの メソッドを使用して、削除するルールのルールIDを取得します。
    curl -X GET --location --header "Authorization: Bearer {iam_token}" --header "Accept: application/json" "{base_url}/v1/zones?account_id={account_id}"
    
    ListZonesOptions listZonesOptions = new ListZonesOptions.Builder()
    .accountId("testString")
    .build();
    
    Response<OutZonePage> response = contextBasedRestrictionsService.listZones(listZonesOptions).execute();
    OutZonePage outZonePage = response.getResult();
    
    System.out.println(outZonePage);
    
     const params = {
       accountId: 'testString',
     };
    
     contextBasedRestrictionsService.listZones(params)
       .then(res => {
         console.log(JSON.stringify(res.result, null, 2));
       })
       .catch(err => {
         console.warn(err)
       });
    
     out_zone_page = context_based_restrictions_service.list_zones(
       account_id='testString'
     ).get_result()
    
     print(json.dumps(out_zone_page, indent=2))
    
     listZonesOptions := contextBasedRestrictionsService.NewListZonesOptions(
       "testString",
     )
    
     outZonePage, response, err := contextBasedRestrictionsService.ListZones(listZonesOptions)
     if err != nil {
       panic(err)
     }
     b, _ := json.MarshalIndent(outZonePage, "", "  ")
     fmt.Println(string(b))
    
  2. 指定したゾーンIDのネットワークゾーンを削除する。
    curl -X DELETE --location --header "Authorization: Bearer {iam_token}" "{base_url}/v1/zones/{zone_id}"
    
     DeleteZoneOptions deleteZoneOptions = new DeleteZoneOptions.Builder()
       .zoneId("testString")
       .build();
    
     Response<Void> response = contextBasedRestrictionsService.deleteZone(deleteZoneOptions).execute();
    
     const params = {
       zoneId: 'testString',
     };
    
     contextBasedRestrictionsService.deleteZone(params)
       .then(res => {
         done();
       })
       .catch(err => {
         console.warn(err)
       });
    
     response = context_based_restrictions_service.delete_zone(
       zone_id='testString'
     )
    
     deleteZoneOptions := contextBasedRestrictionsService.NewDeleteZoneOptions(
       "testString",
     )
    
     response, err := contextBasedRestrictionsService.DeleteZone(deleteZoneOptions)
     if err != nil {
       panic(err)
     }
     if response.StatusCode != 204 {
       fmt.Printf("\nUnexpected response status code received from DeleteZone(): %d\n", response.StatusCode)
     }
    

コンソールを使用したルールとネットワークゾーンの管理機能の制限

このルールを設定するには、 コンテキストベースの制限サービスを対象とする。 ルールを設定する手順の詳細については、 ルールの作成を 参照してください。 すべてのリソースにスコープされたルールは、サービスが管理する現在および将来のすべてのリソースに適用されます。 特定のリソースに対する操作を制限したい場合は、ルールを「 特定のリソース」>「リソースタイプ 」にスコープします。 ルールやネットワーク・ゾーン管理操作を完了するには、ユーザーはIAMアクセス・ポリシーで正しいロールを割り当てられ、コンテキスト・ベースの制限ルールを満たさなければならない。

APIを使用したルールとネットワークゾーンの管理機能の制限

次の例は、ルールとネットワークゾーン管理操作を保護するJSON形式のルールを示す:

{
  "resources": [
    {
      "attributes": [
        {
          "name": "accountId",
          "value": "my-AccountID"
        },
        {
          "name": "serviceName",
          "value": "context-based-restrictions"
        }
      ]
    }
  ],
  "description": "",
  "contexts": [
    {
      "attributes": [
        {
          "name": "networkZoneId",
          "value": "my-zoneID"
        }
      ]
    }
  ],
  "enforcement_mode": "report"
}

accountIdserviceName リソース属性のみを指定するルールは、サービスが管理する現在および将来のすべてのリソースに適用される。 特定のリソースに対する操作を制限したい場合は、対応する resourceType リソース属性を含めてください。 コンテキストベースの制限サービスの有効な resourceType の値は、 rulezone です。

ルールやネットワーク・ゾーン管理操作を完了するには、ユーザーはIAMアクセス・ポリシーで正しいロールを割り当てられ、コンテキスト・ベースの制限ルールを満たさなければならない。