컨텍스트 기반 제한 관리
규칙의 목적을 파악하는 데 도움이 되는 설명을 업데이트하거나 리소스 및 네트워크 환경의 새 목록을 선택하여 언제든지 컨텍스트 규칙을 관리할 수 있습니다. 또한 컨텍스트 기반 제한을 제거하여 규칙의 컨텍스트에 의해 정의된 제한을 삭제할 수도 있습니다.
컨텍스트 기반 제한은 자체 IBM Cloud® 리소스에 대한 액세스 제한을 정의하고 적용할 수 있습니다. 네트워크 영역 및 엔드포인트 유형과 같은 컨텍스트에 따라 이러한 제한을 정의할 수 있습니다. 자세한 정보는 컨텍스트 기반 제한사항은 무엇입니까?를 참조하십시오.
컨텍스트 기반 제한 서비스는 규칙과 네트워크 영역을 관리하므로 컨텍스트 기반 제한 서비스의 규칙을 충족하지 못하면 이러한 리소스를 관리할 수 있는 모든 기능을 잃을 수 있습니다. 이러한 규칙을 만들거나 업데이트하려는 시도는 요청의 컨텍스트가 새 규칙 또는 수정된 규칙을 충족하는 경우에만 허용됩니다.
컨텍스트 기반 제한 서비스를 대상으로 하는 규칙을 더 이상 충족할 수 없는 경우 지원 케이스를 열고 충족할 수 있는 컨텍스트를 제공하여 액세스를 복원하세요.
시작하기 전에
컨텍스트 기반 제한을 관리하려면 계정 관리 서비스에서 관리자 역할을 할당받아야 합니다.
콘솔을 사용하여 규칙 업데이트하기
클라우드 리소스에 대한 컨텍스트 기반 제한을 편집하려면 다음 단계를 완료하세요:
- IBM Cloud 콘솔에서 관리 > 컨텍스트 기반 제한사항을 클릭하고 규칙을 선택하십시오.
- 업데이트하려는 규칙에서 작업 아이콘
선택하고 편집을 선택합니다.
- 규칙에 의해 작업이 제한되는 API의 범위를 업데이트하려면 모든 API 또는 특정 API를 선택합니다. 그런 다음 적용 또는 계속을 클릭하십시오.
- 제한에 대한 리소스 범위를 업데이트하려면 리소스 그룹이나 위치 등 사용 가능한 속성에 따라 모든 리소스 또는 특정 리소스를 선택할 수 있습니다. 그런 다음 적용 또는 계속을 클릭하십시오.
- 요약 패널에서 편집 아이콘
클릭하여 기존 컨텍스트를 업데이트합니다.
- 허용된 엔드포인트 유형을 업데이트합니다.
- 모든 서비스 지원 엔드포인트 유형을 허용하려면 토글을 아니요로 설정합니다.
- 특정 엔드포인트 유형만 허용하려면 토글을 예로 설정합니다.
- 뉴워크 영역을 업데이트합니다. 새 네트워크 영역을 선택하거나 네트워크 영역을 선택 해제하여 제거할 수 있습니다.
- 허용된 엔드포인트 유형을 업데이트합니다.
- 그런 다음 적용을 클릭합니다.
- 제거 아이콘
클릭하여 요약 패널에서 컨텍스트를 제거합니다.
- 모든 엔드포인트 또는 특정 엔드포인트를 선택하고 네트워크 구역을 선택하여 새 컨텍스트를 구성하십시오. 그런 다음 추가를 클릭하십시오.
- 적용 또는 계속을 클릭합니다.
- 규칙에 대한 새 설명을 제공하십시오. 적용을 클릭하여 설명을 업데이트하거나 계속을 클릭합니다.
- 규칙 적용을 업데이트하려면 편집 아이콘
클릭합니다. 규칙을 사용하거나 사용하지 않도록 설정하거나 보고서 전용으로 설정할 수 있습니다.
- 완료하려면 적용을 클릭하십시오.
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를 사용하여 규칙 업데이트하기
규칙을 만들어 클라우드 리소스에 대한 제한을 업데이트하려면 컨텍스트 기반 제한 API를 호출하세요.
-
바꾸려는 규칙을 가져옵니다. 응답 본문에서 규칙 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)) -
다음 예에서는 규칙을 업데이트된 버전으로 바꿉니다. 교체 요청의
If-Match헤더에 ETag 값이 필요합니다.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))
콘솔을 사용하여 네트워크 영역 업데이트하기
액세스 요청이 시작될 수 있는 허용된 위치 목록을 수정할 수 있습니다. 하나 이상의 네트워크 위치 세트는 IP 주소(개별 주소, 범위 또는 서브넷), VPC 또는 서비스 참조로 지정될 수 있습니다. 규칙에 사용되는 네트워크 구역을 업데이트하거나 나중에 새 업데이트된 네트워크 구역을 규칙에 통합할 수 있습니다.
- IBM Cloud 콘솔에서 관리 > 컨텍스트 기반 제한사항을 클릭하고 네트워크 구역을 선택하십시오.
- 업데이트하려는 네트워크 영역에서 작업 아이콘
선택하고 편집을 선택합니다.
- 영역 이름과 설명을 업데이트할 수 있습니다.
- 액세스 요청이 시작될 수 있는 허용된 IP 주소 목록을 편집할 수 있습니다. 필요한 경우 거부 목록에 예외를 포함시키십시오.
- 허용된 VPC를 추가하거나 제거할 수 있습니다.
- 서비스 참조를 추가하거나 제거할 수 있습니다. 해당 IP 주소를 네트워크 영역과 연관시킬 서비스를 선택하십시오.
- 새 구성을 검토하려면 다음을 클릭하십시오.
- 변경사항을 적용하려면 업데이트를 클릭하십시오.
CLI를 사용하여 네트워크 영역 업데이트하기
네트워크 영역을 업데이트하려면 다음 단계를 완료하세요.
- Ibmcloud cbr zones 명령을 사용하여 계정의 모든 영역을 나열하여 업데이트하려는 네트워크 영역의 영역 ID를 검색합니다.
ibmcloud cbr zones - 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를 사용하여 네트워크 영역 업데이트하기
네트워크 영역을 업데이트하려면 다음 단계를 완료하세요.
-
교체하려는 영역을 가져옵니다. 응답 본문에서 영역 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)) -
영역 바꾸기 방법을 사용하여 네트워크 영역을 업데이트합니다. 교체 요청의
If-Match헤더에 ETag 값이 필요합니다.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))
콘솔을 사용하여 규칙 제거하기
규칙을 삭제하면 지정된 리소스에서 컨텍스트 기반 제한사항이 제거되고 사용자에게 올바른 권한이 있는 경우 컨텍스트의 요청이 허용됩니다. 다음 단계를 완료하여 클라우드 리소스에 대한 규칙을 제거할 수 있습니다.
- IBM Cloud 콘솔에서 관리 > 컨텍스트 기반 제한사항으로 이동하여 규칙을 선택하십시오.
- 규칙을 포함하는 행에서 조치 아이콘
를 클릭하고 제거를 클릭하십시오.
CLI를 사용하여 규칙 제거하기
다음 단계를 완료하여 클라우드 리소스에 대한 규칙을 제거할 수 있습니다.
- 문맥 기반 제한 규칙 명령을 사용하여 삭제하려는 규칙의 규칙 ID를 검색합니다. 명령 옵션으로 속성을 지정하여 목록의 검색 결과를 좁힐 수 있습니다.
ibmcloud cbr rules --serviceName "iam-identity" - Cbr rule-delete 명령을 사용하여 지정된 규칙 ID에 대한 규칙을 삭제합니다.
ibmcloud cbr rule-delete 30fd58c9b75f40e854b89c432318b4a2
API를 사용하여 규칙 제거하기
다음 단계를 완료하여 클라우드 리소스에 대한 규칙을 제거할 수 있습니다.
- 문맥 기반 제한 목록 규칙 메서드를 사용하여 삭제하려는 규칙의 규칙 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)) - 지정된 규칙 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) }
콘솔을 사용하여 네트워크 영역 제거하기
네트워크 구역을 제거하면 액세스 요청이 작성되는 허용된 네트워크 위치 세트가 제거됩니다. 네트워크 구역이 규칙에 추가되면 먼저 규칙에서 구역을 제거해야 합니다. 네트워크 영역을 제거하려면 다음 단계를 완료하세요:
- IBM Cloud 콘솔에서 관리 > 컨텍스트 기반 제한으로 이동하여 네트워크 영역을 선택합니다.
- 네트워크 구역이 포함된 행에서 조치 아이콘
를 클릭하고 제거를 클릭하십시오.
CLI를 사용하여 네트워크 영역 제거하기
네트워크 구역을 제거하면 액세스 요청이 작성되는 허용된 네트워크 위치 세트가 제거됩니다. 네트워크 구역이 규칙에 추가되면 먼저 규칙에서 구역을 제거해야 합니다. 규칙에서 영역을 제거하는 방법에 대한 자세한 내용은 컨텍스트 기반 제한 업데이트하기를 참조하세요. 그런 다음, 다음 단계를 완료하십시오.
- 컨텍스트 기반 제한 구역 명령을 사용하여 삭제하려는 네트워크 구역의 구역 ID를 검색합니다. 영역의 이름을 지정하여 목록의 검색 결과를 좁힐 수 있습니다.
ibmcloud cbr zones --name "Example zone" - Cbr zone-delete 명령을 사용하여 지정된 영역 ID에 대한 네트워크 영역을 삭제합니다.
ibmcloud cbr zone-delete 65810ac762004f22ac19f8f8edf70a34
API를 사용하여 네트워크 영역 제거하기
네트워크 구역을 제거하면 액세스 요청이 작성되는 허용된 네트워크 위치 세트가 제거됩니다. 네트워크 구역이 규칙에 추가되면 먼저 규칙에서 구역을 제거해야 합니다. 규칙에서 구역을 제거하는 방법에 대한 자세한 정보는 컨텍스트 기반 제한사항 업데이트를 참조하십시오. 그런 다음, 다음 단계를 완료하십시오.
- 컨텍스트 기반 제한 목록 영역 방법을 사용하여 삭제하려는 규칙의 규칙 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)) - 지정된 영역 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"
}
accountId 및 serviceName 리소스 속성만 지정하는 규칙은 서비스에서 관리하는 모든 현재 및 향후 리소스에 적용됩니다. 특정 리소스에 대한 작업을 제한하려면 해당 resourceType 리소스 속성을 포함하세요. 컨텍스트 기반 제한 서비스에 유효한 resourceType 값은 rule 및 zone 입니다.
규칙 또는 네트워크 영역 관리 작업을 완료하려면 사용자에게 IAM 액세스 정책으로 올바른 역할이 할당되어야 하며 컨텍스트 기반 제한 규칙을 충족해야 합니다.