Methods

Create a network zone

This operation creates a network zone for the specified account.

This operation creates a network zone for the specified account.

This operation creates a network zone for the specified account.

This operation creates a network zone for the specified account.

This operation creates a network zone for the specified account.

POST /v1/zones
(contextBasedRestrictions *ContextBasedRestrictionsV1) CreateZone(createZoneOptions *CreateZoneOptions) (result *Zone, response *core.DetailedResponse, err error)
(contextBasedRestrictions *ContextBasedRestrictionsV1) CreateZoneWithContext(ctx context.Context, createZoneOptions *CreateZoneOptions) (result *Zone, response *core.DetailedResponse, err error)
ServiceCall<Zone> createZone(CreateZoneOptions createZoneOptions)
createZone(params)
create_zone(self,
        *,
        name: str = None,
        account_id: str = None,
        addresses: List['Address'] = None,
        description: str = None,
        excluded: List['Address'] = None,
        x_correlation_id: str = None,
        transaction_id: str = None,
        **kwargs
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • context-based-restrictions.zone.create

Request

Instantiate the CreateZoneOptions struct and set the fields to provide parameter values for the CreateZone method.

Use the CreateZoneOptions.Builder to create a CreateZoneOptions object that contains the parameter values for the createZone method.

Custom Headers

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

The network zone to create.

Examples:
View

WithContext method only

The CreateZone options.

The createZone options.

parameters

  • The name of the zone.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-zA-Z0-9 \\-_]+$/

    Examples:
    value
    _source
    _lines
    _html
  • The id of the account owning this zone.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-zA-Z0-9\\-]+$/

    Examples:
    value
    _source
    _lines
    _html
  • The list of addresses in the zone.

    Possible values: 1 ≤ number of items ≤ 1000

    Examples:
    value
    _source
    _lines
    _html
  • The description of the zone.

    Possible values: 0 ≤ length ≤ 300, Value must match regular expression /^[\\x20-\\xFE]*$/

    Examples:
    value
    _source
    _lines
    _html
  • The list of excluded addresses in the zone. Only addresses of type ipAddress, ipRange, and subnet can be excluded.

    Possible values: number of items ≤ 1000

    Examples:
    value
    _source
    _lines
    _html
  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

parameters

  • The name of the zone.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-zA-Z0-9 \\-_]+$/

    Examples:
    value
    _source
    _lines
    _html
  • The id of the account owning this zone.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-zA-Z0-9\\-]+$/

    Examples:
    value
    _source
    _lines
    _html
  • The list of addresses in the zone.

    Possible values: 1 ≤ number of items ≤ 1000

    Examples:
    value
    _source
    _lines
    _html
  • The description of the zone.

    Possible values: 0 ≤ length ≤ 300, Value must match regular expression /^[\\x20-\\xFE]*$/

    Examples:
    value
    _source
    _lines
    _html
  • The list of excluded addresses in the zone. Only addresses of type ipAddress, ipRange, and subnet can be excluded.

    Possible values: number of items ≤ 1000

    Examples:
    value
    _source
    _lines
    _html
  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • curl -X POST --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   --header "Content-Type: application/json"   --data '{ "name": "an example of zone", "description": "this is an example of zone", "account_id": "12ab34cd56ef78ab90cd12ef34ab56cd", "addresses": [ { "type": "ipAddress", "value": "169.23.56.234" }, { "type": "ipRange", "value": "169.23.22.0-169.23.22.255" }, { "type": "subnet", "value": "192.0.2.0/24" }, { "type": "vpc", "value": "crn:v1:bluemix:public:is:us-south:a/12ab34cd56ef78ab90cd12ef34ab56cd::vpc:r134-d98a1702-b39a-449a-86d4-ef8dbacf281e" }, { "type": "serviceRef", "ref": { "account_id": "12ab34cd56ef78ab90cd12ef34ab56cd", "service_name": "cloud-object-storage" } } ], "excluded": [ { "type": "ipAddress", "value": "169.23.22.127" } ] }'   "{base_url}/v1/zones"
  • ipAddressModel := &contextbasedrestrictionsv1.AddressIPAddress{
      Type:  core.StringPtr("ipAddress"),
      Value: core.StringPtr("169.23.56.234"),
    }
    ipRangeAddressModel := &contextbasedrestrictionsv1.AddressIPAddressRange{
      Type:  core.StringPtr("ipRange"),
      Value: core.StringPtr("169.23.22.0-169.23.22.255"),
    }
    subnetAddressModel := &contextbasedrestrictionsv1.AddressSubnet{
      Type:  core.StringPtr("subnet"),
      Value: core.StringPtr("192.0.2.0/24"),
    }
    vpcAddressModel := &contextbasedrestrictionsv1.AddressVPC{
      Type:  core.StringPtr("vpc"),
      Value: core.StringPtr(vpcCRN),
    }
    serviceRefAddressModel := &contextbasedrestrictionsv1.AddressServiceRef{
      Type: core.StringPtr("serviceRef"),
      Ref: &contextbasedrestrictionsv1.ServiceRefValue{
        AccountID:   core.StringPtr(accountID),
        ServiceName: core.StringPtr("cloud-object-storage"),
      },
    }
    excludedIPAddressModel := &contextbasedrestrictionsv1.AddressIPAddress{
      Type:  core.StringPtr("ipAddress"),
      Value: core.StringPtr("169.23.22.127"),
    }
    
    createZoneOptions := contextBasedRestrictionsService.NewCreateZoneOptions()
    createZoneOptions.SetName("an example of zone")
    createZoneOptions.SetAccountID(accountID)
    createZoneOptions.SetDescription("this is an example of zone")
    createZoneOptions.SetAddresses([]contextbasedrestrictionsv1.AddressIntf{ipAddressModel, ipRangeAddressModel, subnetAddressModel, vpcAddressModel, serviceRefAddressModel})
    createZoneOptions.SetExcluded([]contextbasedrestrictionsv1.AddressIntf{excludedIPAddressModel})
    
    zone, response, err := contextBasedRestrictionsService.CreateZone(createZoneOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(zone, "", "  ")
    fmt.Println(string(b))
  • AddressIPAddress ipAddressModel = new AddressIPAddress.Builder()
      .type("ipAddress")
      .value("169.23.56.234")
      .build();
    AddressIPAddressRange ipRangeAddressModel = new AddressIPAddressRange.Builder()
      .type("ipRange")
      .value("169.23.22.0-169.23.22.255")
      .build();
    AddressSubnet subnetAddressModel = new AddressSubnet.Builder()
      .type("subnet")
      .value("192.0.2.0/24")
      .build();
    AddressVPC vpcAddressModel = new AddressVPC.Builder()
      .type("vpc")
      .value(vpcCRN)
      .build();
    ServiceRefValue serviceRefValueModel = new ServiceRefValue.Builder()
      .accountId(accountID)
      .serviceName("cloud-object-storage")
      .build();
    AddressServiceRef serviceRefAddressModel = new AddressServiceRef.Builder()
      .type("serviceRef")
      .ref(serviceRefValueModel)
      .build();
    AddressIPAddress excludedIPAddressModel = new AddressIPAddress.Builder()
      .type("ipAddress")
      .value("169.23.22.127")
      .build();
    CreateZoneOptions createZoneOptions = new CreateZoneOptions.Builder()
      .name("an example of zone")
      .accountId(accountID)
      .description("this is an example of zone")
      .addresses(java.util.Arrays.asList(ipAddressModel, ipRangeAddressModel, subnetAddressModel, vpcAddressModel, serviceRefAddressModel))
      .excluded(java.util.Arrays.asList(excludedIPAddressModel))
      .build();
    
    Response<Zone> response = contextBasedRestrictionsService.createZone(createZoneOptions).execute();
    Zone zone = response.getResult();
    
    System.out.println(zone);
  • // Request models needed by this operation.
    
    // AddressIPAddress
    const ipAddressModel = {
      type: 'ipAddress',
      value: '169.23.56.234',
    };
    // AddressIPAddressRange
    const ipRangeAddressModel = {
      type: 'ipRange',
      value: '169.23.22.0-169.23.22.255',
    };
    // AddressSubnet
    const subnetAddressModel = {
      type: 'subnet',
      value: '192.0.2.0/24',
    };
    // AddressVPC
    const vpcAddressModel = {
      type: 'vpc',
      value: vpcCRN,
    };
    // AddressServiceRef
    const serviceRefAddressModel = {
      type: 'serviceRef',
      ref: {
        account_id: accountId,
        service_name: 'cloud-object-storage',
      },
    };
    // AddressIPAddress
    const excludedIPAddressModel = {
      type: 'ipAddress',
      value: '169.23.22.127',
    };
    
    const params = {
      name: 'an example of zone',
      accountId,
      addresses: [ipAddressModel, ipRangeAddressModel, subnetAddressModel, vpcAddressModel, serviceRefAddressModel],
      excluded: [excludedIPAddressModel],
      description: 'this is an example of zone',
    };
    
    try {
      const res = await contextBasedRestrictionsService.createZone(params);
      zoneId = res.result.id;
      zoneRev = res.headers.etag;
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
  • ip_address_model = {
      'type': 'ipAddress',
      'value': '169.23.56.234',
    }
    ip_range_address_model = {
      'type': 'ipRange',
      'value': '169.23.22.0-169.23.22.255',
    }
    subnet_address_model = {
      'type': 'subnet',
      'value': '192.0.2.0/24',
    }
    vpc_address_model = {
      'type': 'vpc',
      'value': vpc_crn,
    }
    service_ref_address_model = {
      'type': 'serviceRef',
      'ref': {
        'account_id': account_id,
        'service_name': 'cloud-object-storage',
      }
    }
    excluded_ip_address_model = {
      'type': 'ipAddress',
      'value': '169.23.22.127',
    }
    
    zone = context_based_restrictions_service.create_zone(
      name='an example of zone',
      account_id=account_id,
      addresses=[ip_address_model, ip_range_address_model, subnet_address_model, vpc_address_model, service_ref_address_model],
      excluded=[excluded_ip_address_model],
      description='this is an example of zone',
    ).get_result()
    
    print(json.dumps(zone, indent=2))

Response

An output zone

An output zone.

An output zone.

An output zone.

An output zone.

Status Code

  • Network zone created.

  • The network zone could not be created due to an invalid or missing input parameter or request body.

  • You are not authorized to make this request. The token is either missing, invalid, or expired.

  • The supplied authentication is not authorized to perform the operation.

  • The network zone could not be created due to an already existing zone with the same name.

  • Too Many Requests.

  • A backend service required to complete the operation is unavailable. Try again later.

Example responses
  • {
      "id": "65810ac762004f22ac19f8f8edf70a34",
      "crn": "crn:v1:bluemix:public:context-based-restrictions:global:a/12ab34cd56ef78ab90cd12ef34ab56cd::zone:65810ac762004f22ac19f8f8edf70a34",
      "name": "an example of zone",
      "description": "this is an example of zone",
      "account_id": "12ab34cd56ef78ab90cd12ef34ab56cd",
      "addresses": [
        {
          "type": "ipAddress",
          "value": "169.23.56.234"
        },
        {
          "type": "ipRange",
          "value": "169.23.22.0-169.23.22.255"
        },
        {
          "type": "subnet",
          "value": "192.0.2.0/24"
        },
        {
          "type": "vpc",
          "value": "crn:v1:bluemix:public:is:us-south:a/12ab34cd56ef78ab90cd12ef34ab56cd::vpc:r134-d98a1702-b39a-449a-86d4-ef8dbacf281e"
        }
      ],
      "excluded": [
        {
          "type": "ipAddress",
          "value": "169.23.22.127"
        }
      ],
      "address_count": 4,
      "excluded_count": 1,
      "href": "https://cbr.cloud.ibm.com/v1/zones/65810ac762004f22ac19f8f8edf70a34",
      "created_at": "2020-11-23T02:01:59Z",
      "created_by_id": "IBMid-120000P1JM",
      "last_modified_at": "2020-11-23T02:01:59Z",
      "last_modified_by_id": "IBMid-120000P1JM"
    }
  • {
      "id": "65810ac762004f22ac19f8f8edf70a34",
      "crn": "crn:v1:bluemix:public:context-based-restrictions:global:a/12ab34cd56ef78ab90cd12ef34ab56cd::zone:65810ac762004f22ac19f8f8edf70a34",
      "name": "an example of zone",
      "description": "this is an example of zone",
      "account_id": "12ab34cd56ef78ab90cd12ef34ab56cd",
      "addresses": [
        {
          "type": "ipAddress",
          "value": "169.23.56.234"
        },
        {
          "type": "ipRange",
          "value": "169.23.22.0-169.23.22.255"
        },
        {
          "type": "subnet",
          "value": "192.0.2.0/24"
        },
        {
          "type": "vpc",
          "value": "crn:v1:bluemix:public:is:us-south:a/12ab34cd56ef78ab90cd12ef34ab56cd::vpc:r134-d98a1702-b39a-449a-86d4-ef8dbacf281e"
        }
      ],
      "excluded": [
        {
          "type": "ipAddress",
          "value": "169.23.22.127"
        }
      ],
      "address_count": 4,
      "excluded_count": 1,
      "href": "https://cbr.cloud.ibm.com/v1/zones/65810ac762004f22ac19f8f8edf70a34",
      "created_at": "2020-11-23T02:01:59Z",
      "created_by_id": "IBMid-120000P1JM",
      "last_modified_at": "2020-11-23T02:01:59Z",
      "last_modified_by_id": "IBMid-120000P1JM"
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "request_body_error",
          "message": "The request body has an error.",
          "cause": "property `account_id` is missing"
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "request_body_error",
          "message": "The request body has an error.",
          "cause": "property `account_id` is missing"
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 403,
      "errors": [
        {
          "code": "request_not_authorized",
          "message": "The request could not be authorized."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 403,
      "errors": [
        {
          "code": "request_not_authorized",
          "message": "The request could not be authorized."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 409,
      "errors": [
        {
          "code": "zone_already_exists_in_store",
          "message": "A zone with the same name already exists. Assign each zone a unique name.",
          "target": {
            "name": "name",
            "type": "field",
            "value": "an-already-existing-zone-name"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 409,
      "errors": [
        {
          "code": "zone_already_exists_in_store",
          "message": "A zone with the same name already exists. Assign each zone a unique name.",
          "target": {
            "name": "name",
            "type": "field",
            "value": "an-already-existing-zone-name"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }

List network zones

This operation lists network zones in the specified account.

This operation lists network zones in the specified account.

This operation lists network zones in the specified account.

This operation lists network zones in the specified account.

This operation lists network zones in the specified account.

GET /v1/zones
(contextBasedRestrictions *ContextBasedRestrictionsV1) ListZones(listZonesOptions *ListZonesOptions) (result *ZoneList, response *core.DetailedResponse, err error)
(contextBasedRestrictions *ContextBasedRestrictionsV1) ListZonesWithContext(ctx context.Context, listZonesOptions *ListZonesOptions) (result *ZoneList, response *core.DetailedResponse, err error)
ServiceCall<ZoneList> listZones(ListZonesOptions listZonesOptions)
listZones(params)
list_zones(self,
        account_id: str,
        *,
        x_correlation_id: str = None,
        transaction_id: str = None,
        name: str = None,
        sort: str = None,
        **kwargs
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • context-based-restrictions.zone.read

Request

Instantiate the ListZonesOptions struct and set the fields to provide parameter values for the ListZones method.

Use the ListZonesOptions.Builder to create a ListZonesOptions object that contains the parameter values for the listZones method.

Custom Headers

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

Query Parameters

  • The ID of the managing account.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression ^[a-zA-Z0-9\-]+$

  • The name of the zone.

    Possible values: 1 ≤ length ≤ 100, Value must match regular expression ^\*?[a-zA-Z0-9 \-_]+\*?$

  • Sorts results by using a valid sort field. To learn more, see Sorting.

    Possible values: 1 ≤ length ≤ 32, Value must match regular expression ^[\-]?[a-z0-9_]+$

WithContext method only

The ListZones options.

The listZones options.

parameters

  • The ID of the managing account.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-zA-Z0-9\\-]+$/

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The name of the zone.

    Possible values: 1 ≤ length ≤ 100, Value must match regular expression /^\\*?[a-zA-Z0-9 \\-_]+\\*?$/

  • Sorts results by using a valid sort field. To learn more, see Sorting.

    Possible values: 1 ≤ length ≤ 32, Value must match regular expression /^[\\-]?[a-z0-9_]+$/

parameters

  • The ID of the managing account.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-zA-Z0-9\\-]+$/

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The name of the zone.

    Possible values: 1 ≤ length ≤ 100, Value must match regular expression /^\\*?[a-zA-Z0-9 \\-_]+\\*?$/

  • Sorts results by using a valid sort field. To learn more, see Sorting.

    Possible values: 1 ≤ length ≤ 32, Value must match regular expression /^[\\-]?[a-z0-9_]+$/

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/v1/zones?account_id={account_id}"
  • listZonesOptions := contextBasedRestrictionsService.NewListZonesOptions(
      accountID,
    )
    
    zoneList, response, err := contextBasedRestrictionsService.ListZones(listZonesOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(zoneList, "", "  ")
    fmt.Println(string(b))
  • ListZonesOptions listZonesOptions = new ListZonesOptions.Builder()
      .accountId(accountID)
      .build();
    
    Response<ZoneList> response = contextBasedRestrictionsService.listZones(listZonesOptions).execute();
    ZoneList zoneList = response.getResult();
    
    System.out.println(zoneList);
  • const params = {
      accountId,
    };
    
    try {
      const res = await contextBasedRestrictionsService.listZones(params);
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
  • zone_list = context_based_restrictions_service.list_zones(
      account_id=account_id
    ).get_result()
    
    print(json.dumps(zone_list, indent=2))

Response

The response object of the ListZones operation.

The response object of the ListZones operation.

The response object of the ListZones operation.

The response object of the ListZones operation.

The response object of the ListZones operation.

Status Code

  • The network zones were successfully retrieved.

  • The network zones could not be retrieved due to an invalid or missing input parameter.

  • You are not authorized to make this request. The token is either missing, invalid, or expired.

  • The supplied authentication is not authorized to perform the operation.

  • Too Many Requests.

  • A backend service required to complete the operation is unavailable. Try again later.

Example responses
  • {
      "count": 1,
      "zones": [
        {
          "id": "65810ac762004f22ac19f8f8edf70a34",
          "crn": "crn:v1:bluemix:public:context-based-restrictions:global:a/12ab34cd56ef78ab90cd12ef34ab56cd::zone:65810ac762004f22ac19f8f8edf70a34",
          "name": "an example of zone",
          "description": "this is an example of zone",
          "addresses_preview": [
            {
              "type": "ipAddress",
              "value": "169.23.56.234"
            },
            {
              "type": "ipRange",
              "value": "169.23.22.0-169.23.22.255"
            },
            {
              "type": "subnet",
              "value": "192.0.2.0/24"
            }
          ],
          "address_count": 4,
          "excluded_count": 1,
          "href": "https://cbr.cloud.ibm.com/v1/zones/65810ac762004f22ac19f8f8edf70a34",
          "created_at": "2020-11-23T02:01:59Z",
          "created_by_id": "IBMid-120000P1JM",
          "last_modified_at": "2020-11-23T02:01:59Z",
          "last_modified_by_id": "IBMid-120000P1JM"
        }
      ]
    }
  • {
      "count": 1,
      "zones": [
        {
          "id": "65810ac762004f22ac19f8f8edf70a34",
          "crn": "crn:v1:bluemix:public:context-based-restrictions:global:a/12ab34cd56ef78ab90cd12ef34ab56cd::zone:65810ac762004f22ac19f8f8edf70a34",
          "name": "an example of zone",
          "description": "this is an example of zone",
          "addresses_preview": [
            {
              "type": "ipAddress",
              "value": "169.23.56.234"
            },
            {
              "type": "ipRange",
              "value": "169.23.22.0-169.23.22.255"
            },
            {
              "type": "subnet",
              "value": "192.0.2.0/24"
            }
          ],
          "address_count": 4,
          "excluded_count": 1,
          "href": "https://cbr.cloud.ibm.com/v1/zones/65810ac762004f22ac19f8f8edf70a34",
          "created_at": "2020-11-23T02:01:59Z",
          "created_by_id": "IBMid-120000P1JM",
          "last_modified_at": "2020-11-23T02:01:59Z",
          "last_modified_by_id": "IBMid-120000P1JM"
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "parameter_error",
          "message": "The parameter \"account_id\" in query has an error.",
          "target": {
            "name": "account_id",
            "type": "parameter",
            "value": "an-invalid-account-id"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "parameter_error",
          "message": "The parameter \"account_id\" in query has an error.",
          "target": {
            "name": "account_id",
            "type": "parameter",
            "value": "an-invalid-account-id"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 403,
      "errors": [
        {
          "code": "request_not_authorized",
          "message": "The request could not be authorized."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 403,
      "errors": [
        {
          "code": "request_not_authorized",
          "message": "The request could not be authorized."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }

Get a network zone

This operation retrieves the network zone identified by the specified zone ID.

This operation retrieves the network zone identified by the specified zone ID.

This operation retrieves the network zone identified by the specified zone ID.

This operation retrieves the network zone identified by the specified zone ID.

This operation retrieves the network zone identified by the specified zone ID.

GET /v1/zones/{zone_id}
(contextBasedRestrictions *ContextBasedRestrictionsV1) GetZone(getZoneOptions *GetZoneOptions) (result *Zone, response *core.DetailedResponse, err error)
(contextBasedRestrictions *ContextBasedRestrictionsV1) GetZoneWithContext(ctx context.Context, getZoneOptions *GetZoneOptions) (result *Zone, response *core.DetailedResponse, err error)
ServiceCall<Zone> getZone(GetZoneOptions getZoneOptions)
getZone(params)
get_zone(self,
        zone_id: str,
        *,
        x_correlation_id: str = None,
        transaction_id: str = None,
        **kwargs
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • context-based-restrictions.zone.read

Request

Instantiate the GetZoneOptions struct and set the fields to provide parameter values for the GetZone method.

Use the GetZoneOptions.Builder to create a GetZoneOptions object that contains the parameter values for the getZone method.

Custom Headers

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

Path Parameters

  • The ID of a zone.

    Possible values: length = 32, Value must match regular expression ^[a-fA-F0-9]{32}$

WithContext method only

The GetZone options.

The getZone options.

parameters

  • The ID of a zone.

    Possible values: length = 32, Value must match regular expression /^[a-fA-F0-9]{32}$/

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

parameters

  • The ID of a zone.

    Possible values: length = 32, Value must match regular expression /^[a-fA-F0-9]{32}$/

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/v1/zones/{zone_id}"
  • getZoneOptions := contextBasedRestrictionsService.NewGetZoneOptions(
      zoneID,
    )
    
    zone, response, err := contextBasedRestrictionsService.GetZone(getZoneOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(zone, "", "  ")
    fmt.Println(string(b))
  • 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))

Response

An output zone

An output zone.

An output zone.

An output zone.

An output zone.

Status Code

  • The network zone was successfully retrieved.

  • The network zone could not be retrieved due to an invalid or missing input parameter.

  • You are not authorized to make this request. The token is either missing, invalid, or expired.

  • The supplied authentication is not authorized to perform the operation.

  • The network zone could not be found. Verify that the specified zone ID is valid.

  • Too Many Requests.

  • A backend service required to complete the operation is unavailable. Try again later.

Example responses
  • {
      "id": "65810ac762004f22ac19f8f8edf70a34",
      "crn": "crn:v1:bluemix:public:context-based-restrictions:global:a/12ab34cd56ef78ab90cd12ef34ab56cd::zone:65810ac762004f22ac19f8f8edf70a34",
      "name": "an example of zone",
      "description": "this is an example of zone",
      "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"
        }
      ],
      "excluded": [
        {
          "type": "ipAddress",
          "value": "169.23.22.127"
        }
      ],
      "address_count": 3,
      "excluded_count": 1,
      "href": "https://cbr.cloud.ibm.com/v1/zones/65810ac762004f22ac19f8f8edf70a34",
      "created_at": "2020-11-23T02:01:59Z",
      "created_by_id": "IBMid-120000P1JM",
      "last_modified_at": "2020-11-23T02:01:59Z",
      "last_modified_by_id": "IBMid-120000P1JM"
    }
  • {
      "id": "65810ac762004f22ac19f8f8edf70a34",
      "crn": "crn:v1:bluemix:public:context-based-restrictions:global:a/12ab34cd56ef78ab90cd12ef34ab56cd::zone:65810ac762004f22ac19f8f8edf70a34",
      "name": "an example of zone",
      "description": "this is an example of zone",
      "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"
        }
      ],
      "excluded": [
        {
          "type": "ipAddress",
          "value": "169.23.22.127"
        }
      ],
      "address_count": 3,
      "excluded_count": 1,
      "href": "https://cbr.cloud.ibm.com/v1/zones/65810ac762004f22ac19f8f8edf70a34",
      "created_at": "2020-11-23T02:01:59Z",
      "created_by_id": "IBMid-120000P1JM",
      "last_modified_at": "2020-11-23T02:01:59Z",
      "last_modified_by_id": "IBMid-120000P1JM"
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "parameter_error",
          "message": "The parameter \"zone_id\" in path has an error.",
          "target": {
            "name": "zone_id",
            "type": "parameter",
            "value": "an-invalid-zone-id"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "parameter_error",
          "message": "The parameter \"zone_id\" in path has an error.",
          "target": {
            "name": "zone_id",
            "type": "parameter",
            "value": "an-invalid-zone-id"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 403,
      "errors": [
        {
          "code": "request_not_authorized",
          "message": "The request could not be authorized."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 403,
      "errors": [
        {
          "code": "request_not_authorized",
          "message": "The request could not be authorized."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 404,
      "errors": [
        {
          "code": "zone_not_found_in_store",
          "message": "The zone '65810ac762004f22ac19f8f8edf70a34' is not found.",
          "target": {
            "name": "zone_id",
            "type": "parameter",
            "value": "65810ac762004f22ac19f8f8edf70a34"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 404,
      "errors": [
        {
          "code": "zone_not_found_in_store",
          "message": "The zone '65810ac762004f22ac19f8f8edf70a34' is not found.",
          "target": {
            "name": "zone_id",
            "type": "parameter",
            "value": "65810ac762004f22ac19f8f8edf70a34"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }

Replace a network zone

This operation replaces the network zone identified by the specified zone ID. Partial updates are not supported. The entire network zone object must be replaced.

This operation replaces the network zone identified by the specified zone ID. Partial updates are not supported. The entire network zone object must be replaced.

This operation replaces the network zone identified by the specified zone ID. Partial updates are not supported. The entire network zone object must be replaced.

This operation replaces the network zone identified by the specified zone ID. Partial updates are not supported. The entire network zone object must be replaced.

This operation replaces the network zone identified by the specified zone ID. Partial updates are not supported. The entire network zone object must be replaced.

PUT /v1/zones/{zone_id}
(contextBasedRestrictions *ContextBasedRestrictionsV1) ReplaceZone(replaceZoneOptions *ReplaceZoneOptions) (result *Zone, response *core.DetailedResponse, err error)
(contextBasedRestrictions *ContextBasedRestrictionsV1) ReplaceZoneWithContext(ctx context.Context, replaceZoneOptions *ReplaceZoneOptions) (result *Zone, response *core.DetailedResponse, err error)
ServiceCall<Zone> replaceZone(ReplaceZoneOptions replaceZoneOptions)
replaceZone(params)
replace_zone(self,
        zone_id: str,
        if_match: str,
        *,
        name: str = None,
        account_id: str = None,
        addresses: List['Address'] = None,
        description: str = None,
        excluded: List['Address'] = None,
        x_correlation_id: str = None,
        transaction_id: str = None,
        **kwargs
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • context-based-restrictions.zone.update

Request

Instantiate the ReplaceZoneOptions struct and set the fields to provide parameter values for the ReplaceZone method.

Use the ReplaceZoneOptions.Builder to create a ReplaceZoneOptions object that contains the parameter values for the replaceZone method.

Custom Headers

  • The current revision of the resource being updated. This can be found in the Create/Get/Update resource response ETag header.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression ^[a-fA-F0-9\-]+$

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

Path Parameters

  • The ID of a zone.

    Possible values: length = 32, Value must match regular expression ^[a-fA-F0-9]{32}$

The network zone to replace.

Examples:
View

WithContext method only

The ReplaceZone options.

The replaceZone options.

parameters

  • The ID of a zone.

    Possible values: length = 32, Value must match regular expression /^[a-fA-F0-9]{32}$/

  • The current revision of the resource being updated. This can be found in the Create/Get/Update resource response ETag header.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-fA-F0-9\\-]+$/

  • The name of the zone.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-zA-Z0-9 \\-_]+$/

    Examples:
    value
    _source
    _lines
    _html
  • The id of the account owning this zone.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-zA-Z0-9\\-]+$/

    Examples:
    value
    _source
    _lines
    _html
  • The list of addresses in the zone.

    Possible values: 1 ≤ number of items ≤ 1000

    Examples:
    value
    _source
    _lines
    _html
  • The description of the zone.

    Possible values: 0 ≤ length ≤ 300, Value must match regular expression /^[\\x20-\\xFE]*$/

    Examples:
    value
    _source
    _lines
    _html
  • The list of excluded addresses in the zone. Only addresses of type ipAddress, ipRange, and subnet can be excluded.

    Possible values: number of items ≤ 1000

    Examples:
    value
    _source
    _lines
    _html
  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

parameters

  • The ID of a zone.

    Possible values: length = 32, Value must match regular expression /^[a-fA-F0-9]{32}$/

  • The current revision of the resource being updated. This can be found in the Create/Get/Update resource response ETag header.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-fA-F0-9\\-]+$/

  • The name of the zone.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-zA-Z0-9 \\-_]+$/

    Examples:
    value
    _source
    _lines
    _html
  • The id of the account owning this zone.

    Possible values: 1 ≤ length ≤ 128, Value must match regular expression /^[a-zA-Z0-9\\-]+$/

    Examples:
    value
    _source
    _lines
    _html
  • The list of addresses in the zone.

    Possible values: 1 ≤ number of items ≤ 1000

    Examples:
    value
    _source
    _lines
    _html
  • The description of the zone.

    Possible values: 0 ≤ length ≤ 300, Value must match regular expression /^[\\x20-\\xFE]*$/

    Examples:
    value
    _source
    _lines
    _html
  • The list of excluded addresses in the zone. Only addresses of type ipAddress, ipRange, and subnet can be excluded.

    Possible values: number of items ≤ 1000

    Examples:
    value
    _source
    _lines
    _html
  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • 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": "an example of zone", "description": "this is an example of zone", "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" } ], "excluded": [ { "type": "ipAddress", "value": "169.23.22.128" } ] }'   "{base_url}/v1/zones/{zone_id}"
  • addressModel := &contextbasedrestrictionsv1.AddressIPAddress{
      Type:  core.StringPtr("ipAddress"),
      Value: core.StringPtr("169.23.56.234"),
    }
    
    replaceZoneOptions := contextBasedRestrictionsService.NewReplaceZoneOptions(
      zoneID,
      zoneRev,
    )
    replaceZoneOptions.SetName("an example of updated zone")
    replaceZoneOptions.SetAccountID(accountID)
    replaceZoneOptions.SetDescription("this is an example of updated zone")
    replaceZoneOptions.SetAddresses([]contextbasedrestrictionsv1.AddressIntf{addressModel})
    
    zone, response, err := contextBasedRestrictionsService.ReplaceZone(replaceZoneOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(zone, "", "  ")
    fmt.Println(string(b))
  • AddressIPAddress addressModel = new AddressIPAddress.Builder()
      .type("ipAddress")
      .value("169.23.56.234")
      .build();
    ReplaceZoneOptions replaceZoneOptions = new ReplaceZoneOptions.Builder()
      .zoneId(zoneID)
      .ifMatch(zoneRev)
      .name("an example of zone")
      .accountId(accountID)
      .description("this is an example of updated zone")
      .addresses(java.util.Arrays.asList(addressModel))
      .build();
    
    Response<Zone> response = contextBasedRestrictionsService.replaceZone(replaceZoneOptions).execute();
    Zone zone = response.getResult();
    
    System.out.println(zone);
  • // Request models needed by this operation.
    
    // AddressIPAddress
    const addressModel = {
      type: 'ipAddress',
      value: '169.23.56.234',
    };
    
    const params = {
      zoneId,
      ifMatch: zoneRev,
      name: 'an example of updated zone',
      accountId,
      addresses: [addressModel],
      description: 'this is an example of updated zone',
    };
    
    try {
      const res = await contextBasedRestrictionsService.replaceZone(params);
      zoneId = res.result.id;
      zoneRev = res.headers.etag;
    
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
  • address_model = {
      'type': 'ipAddress',
      'value': '169.23.56.234',
    }
    
    zone = context_based_restrictions_service.replace_zone(
      zone_id=zone_id,
      if_match=zone_rev,
      name='an example of updated zone',
      account_id=account_id,
      addresses=[address_model],
      description='this is an example of updated zone',
    ).get_result()
    
    print(json.dumps(zone, indent=2))

Response

An output zone

An output zone.

An output zone.

An output zone.

An output zone.

Status Code

  • The network zone was successfully replaced.

  • The network zone could not be replaced due to an invalid or missing input parameter.

  • You are not authorized to make this request. The token is either missing, invalid, or expired.

  • The supplied authentication is not authorized to perform the operation.

  • The network zone could not be found. Verify that the specified zone ID is valid.

  • The network zone revision is missing or invalid.

  • Too Many Requests.

  • A backend service required to complete the operation is unavailable. Try again later.

Example responses
  • {
      "id": "65810ac762004f22ac19f8f8edf70a34",
      "crn": "crn:v1:bluemix:public:context-based-restrictions:global:a/12ab34cd56ef78ab90cd12ef34ab56cd::zone:65810ac762004f22ac19f8f8edf70a34",
      "name": "an example of zone",
      "description": "this is an example of zone",
      "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"
        }
      ],
      "excluded": [
        {
          "type": "ipAddress",
          "value": "169.23.22.128"
        }
      ],
      "address_count": 3,
      "excluded_count": 1,
      "href": "https://cbr.cloud.ibm.com/v1/zones/65810ac762004f22ac19f8f8edf70a34",
      "created_at": "2020-11-23T02:01:59Z",
      "created_by_id": "IBMid-120000P1JM",
      "last_modified_at": "2020-11-23T02:05:00Z",
      "last_modified_by_id": "IBMid-120000P1JM"
    }
  • {
      "id": "65810ac762004f22ac19f8f8edf70a34",
      "crn": "crn:v1:bluemix:public:context-based-restrictions:global:a/12ab34cd56ef78ab90cd12ef34ab56cd::zone:65810ac762004f22ac19f8f8edf70a34",
      "name": "an example of zone",
      "description": "this is an example of zone",
      "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"
        }
      ],
      "excluded": [
        {
          "type": "ipAddress",
          "value": "169.23.22.128"
        }
      ],
      "address_count": 3,
      "excluded_count": 1,
      "href": "https://cbr.cloud.ibm.com/v1/zones/65810ac762004f22ac19f8f8edf70a34",
      "created_at": "2020-11-23T02:01:59Z",
      "created_by_id": "IBMid-120000P1JM",
      "last_modified_at": "2020-11-23T02:05:00Z",
      "last_modified_by_id": "IBMid-120000P1JM"
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "invalid_ip_range_value_first_ip_greater_than_last_ip",
          "message": "Invalid `ipRange` value: the first IP address is greater than last IP address.",
          "target": {
            "name": "value",
            "type": "field",
            "value": "169.25.27.0-169.25.26.255"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "invalid_ip_range_value_first_ip_greater_than_last_ip",
          "message": "Invalid `ipRange` value: the first IP address is greater than last IP address.",
          "target": {
            "name": "value",
            "type": "field",
            "value": "169.25.27.0-169.25.26.255"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 403,
      "errors": [
        {
          "code": "request_not_authorized",
          "message": "The request could not be authorized."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 403,
      "errors": [
        {
          "code": "request_not_authorized",
          "message": "The request could not be authorized."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 404,
      "errors": [
        {
          "code": "zone_not_found_in_store",
          "message": "The zone '65810ac762004f22ac19f8f8edf70a34' is not found.",
          "target": {
            "name": "zone_id",
            "type": "parameter",
            "value": "65810ac762004f22ac19f8f8edf70a34"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 404,
      "errors": [
        {
          "code": "zone_not_found_in_store",
          "message": "The zone '65810ac762004f22ac19f8f8edf70a34' is not found.",
          "target": {
            "name": "zone_id",
            "type": "parameter",
            "value": "65810ac762004f22ac19f8f8edf70a34"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 412,
      "errors": [
        {
          "code": "invalid_zone_revision",
          "message": "The zone revision is missing or invalid.",
          "target": {
            "name": "If-Match",
            "type": "header",
            "value": "an-invalid-revision"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 412,
      "errors": [
        {
          "code": "invalid_zone_revision",
          "message": "The zone revision is missing or invalid.",
          "target": {
            "name": "If-Match",
            "type": "header",
            "value": "an-invalid-revision"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }

Delete a network zone

This operation deletes the network zone identified by the specified zone ID.

This operation deletes the network zone identified by the specified zone ID.

This operation deletes the network zone identified by the specified zone ID.

This operation deletes the network zone identified by the specified zone ID.

This operation deletes the network zone identified by the specified zone ID.

DELETE /v1/zones/{zone_id}
(contextBasedRestrictions *ContextBasedRestrictionsV1) DeleteZone(deleteZoneOptions *DeleteZoneOptions) (response *core.DetailedResponse, err error)
(contextBasedRestrictions *ContextBasedRestrictionsV1) DeleteZoneWithContext(ctx context.Context, deleteZoneOptions *DeleteZoneOptions) (response *core.DetailedResponse, err error)
ServiceCall<Void> deleteZone(DeleteZoneOptions deleteZoneOptions)
deleteZone(params)
delete_zone(self,
        zone_id: str,
        *,
        x_correlation_id: str = None,
        transaction_id: str = None,
        **kwargs
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • context-based-restrictions.zone.delete

Request

Instantiate the DeleteZoneOptions struct and set the fields to provide parameter values for the DeleteZone method.

Use the DeleteZoneOptions.Builder to create a DeleteZoneOptions object that contains the parameter values for the deleteZone method.

Custom Headers

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

Path Parameters

  • The ID of a zone.

    Possible values: length = 32, Value must match regular expression ^[a-fA-F0-9]{32}$

WithContext method only

The DeleteZone options.

The deleteZone options.

parameters

  • The ID of a zone.

    Possible values: length = 32, Value must match regular expression /^[a-fA-F0-9]{32}$/

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

parameters

  • The ID of a zone.

    Possible values: length = 32, Value must match regular expression /^[a-fA-F0-9]{32}$/

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • curl -X DELETE --location --header "Authorization: Bearer {iam_token}"   "{base_url}/v1/zones/{zone_id}"
  • deleteZoneOptions := contextBasedRestrictionsService.NewDeleteZoneOptions(
      zoneID,
    )
    
    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)
    }
  • DeleteZoneOptions deleteZoneOptions = new DeleteZoneOptions.Builder()
      .zoneId(zoneID)
      .build();
    
    Response<Void> response = contextBasedRestrictionsService.deleteZone(deleteZoneOptions).execute();
  • const params = {
      zoneId,
    };
    
    try {
      await contextBasedRestrictionsService.deleteZone(params);
    } catch (err) {
      console.warn(err);
    }
  • response = context_based_restrictions_service.delete_zone(
      zone_id=zone_id
    )

Response

Status Code

  • The network zone was successfully deleted.

  • The network zone could not be deleted due to an invalid or missing input parameter.

  • You are not authorized to make this request. The token is either missing, invalid, or expired.

  • The supplied authentication is not authorized to perform the operation.

  • The network zone could not be found. Verify that the specified zone ID is valid.

  • Precondition not satisfied. A network zone cannot be deleted if it is referenced by one or more rules.

  • Too Many Requests.

  • A backend service required to complete the operation is unavailable. Try again later.

Example responses
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "parameter_error",
          "message": "The parameter \"zone_id\" in path has an error.",
          "target": {
            "name": "zone_id",
            "type": "parameter",
            "value": "an-invalid-zone-id"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "parameter_error",
          "message": "The parameter \"zone_id\" in path has an error.",
          "target": {
            "name": "zone_id",
            "type": "parameter",
            "value": "an-invalid-zone-id"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 403,
      "errors": [
        {
          "code": "request_not_authorized",
          "message": "The request could not be authorized."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 403,
      "errors": [
        {
          "code": "request_not_authorized",
          "message": "The request could not be authorized."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 404,
      "errors": [
        {
          "code": "zone_not_found_in_store",
          "message": "The zone '65810ac762004f22ac19f8f8edf70a34' is not found.",
          "target": {
            "name": "zone_id",
            "type": "parameter",
            "value": "65810ac762004f22ac19f8f8edf70a34"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 404,
      "errors": [
        {
          "code": "zone_not_found_in_store",
          "message": "The zone '65810ac762004f22ac19f8f8edf70a34' is not found.",
          "target": {
            "name": "zone_id",
            "type": "parameter",
            "value": "65810ac762004f22ac19f8f8edf70a34"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 412,
      "errors": [
        {
          "code": "zone_used_by_rule",
          "message": "The zone '65810ac762004f22ac19f8f8edf70a34' is referenced by one or more rules and cannot be deleted."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 412,
      "errors": [
        {
          "code": "zone_used_by_rule",
          "message": "The zone '65810ac762004f22ac19f8f8edf70a34' is referenced by one or more rules and cannot be deleted."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }

List available service reference targets

This operation lists all available service reference targets

This operation lists all available service reference targets.

This operation lists all available service reference targets.

This operation lists all available service reference targets.

This operation lists all available service reference targets.

GET /v1/zones/serviceref_targets
(contextBasedRestrictions *ContextBasedRestrictionsV1) ListAvailableServicerefTargets(listAvailableServicerefTargetsOptions *ListAvailableServicerefTargetsOptions) (result *ServiceRefTargetList, response *core.DetailedResponse, err error)
(contextBasedRestrictions *ContextBasedRestrictionsV1) ListAvailableServicerefTargetsWithContext(ctx context.Context, listAvailableServicerefTargetsOptions *ListAvailableServicerefTargetsOptions) (result *ServiceRefTargetList, response *core.DetailedResponse, err error)
ServiceCall<ServiceRefTargetList> listAvailableServicerefTargets(ListAvailableServicerefTargetsOptions listAvailableServicerefTargetsOptions)
listAvailableServicerefTargets(params)
list_available_serviceref_targets(self,
        *,
        x_correlation_id: str = None,
        transaction_id: str = None,
        type: str = None,
        **kwargs
    ) -> DetailedResponse

Request

Instantiate the ListAvailableServicerefTargetsOptions struct and set the fields to provide parameter values for the ListAvailableServicerefTargets method.

Use the ListAvailableServicerefTargetsOptions.Builder to create a ListAvailableServicerefTargetsOptions object that contains the parameter values for the listAvailableServicerefTargets method.

Custom Headers

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

Query Parameters

  • Specifies the types of services to retrieve

    Allowable values: [all,platform_service]

    Default: all

WithContext method only

The ListAvailableServicerefTargets options.

The listAvailableServicerefTargets options.

parameters

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • Specifies the types of services to retrieve.

    Allowable values: [all,platform_service]

    Default: all

parameters

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • Specifies the types of services to retrieve.

    Allowable values: [all,platform_service]

    Default: all

  • curl -X GET --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   "{base_url}/v1/zones/serviceref_targets"
  • listAvailableServiceRefTargetsOptions := contextBasedRestrictionsService.NewListAvailableServicerefTargetsOptions()
    
    serviceRefTargetList, response, err := contextBasedRestrictionsService.ListAvailableServicerefTargets(listAvailableServiceRefTargetsOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(serviceRefTargetList, "", "  ")
    fmt.Println(string(b))
  • ListAvailableServicerefTargetsOptions listAvailableServicerefTargetsOptions = new ListAvailableServicerefTargetsOptions.Builder()
      .build();
    
    Response<ServiceRefTargetList> response = contextBasedRestrictionsService.listAvailableServicerefTargets(listAvailableServicerefTargetsOptions).execute();
    ServiceRefTargetList serviceRefTargetList = response.getResult();
    
    System.out.println(serviceRefTargetList);
  • try {
      const res = await contextBasedRestrictionsService.listAvailableServicerefTargets({});
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
  • service_ref_target_list = context_based_restrictions_service.list_available_serviceref_targets().get_result()
    
    print(json.dumps(service_ref_target_list, indent=2))

Response

A list of service reference targets

A list of service reference targets.

A list of service reference targets.

A list of service reference targets.

A list of service reference targets.

Status Code

  • The service reference targets were successfully retrieved.

  • The service reference targets could not be retrieved due to an invalid or missing input parameter.

  • You are not authorized to make this request. The token is either missing, invalid, or expired.

  • Too Many Requests.

  • A backend service required to complete the operation is unavailable. Try again later.

Example responses
  • {
      "count": 2,
      "targets": [
        {
          "service_name": "ace"
        },
        {
          "service_name": "iam-groups",
          "service_type": "platform_service"
        }
      ]
    }
  • {
      "count": 2,
      "targets": [
        {
          "service_name": "ace"
        },
        {
          "service_name": "iam-groups",
          "service_type": "platform_service"
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "parameter_error",
          "message": "The parameter \"type\" in query has an error.",
          "target": {
            "name": "type",
            "type": "parameter",
            "value": "an-invalid-type"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 400,
      "errors": [
        {
          "code": "parameter_error",
          "message": "The parameter \"type\" in query has an error.",
          "target": {
            "name": "type",
            "type": "parameter",
            "value": "an-invalid-type"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 401,
      "errors": [
        {
          "code": "invalid_auth_token",
          "message": "The token failed to validate.",
          "target": {
            "name": "Authorization",
            "type": "header"
          }
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 429,
      "errors": [
        {
          "code": "too_many_requests",
          "message": "The client has sent too many requests in a given amount of time."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }
  • {
      "trace": "b05ed07e-c4d9-4285-841c-1e954c0b4a0e",
      "status_code": 503,
      "errors": [
        {
          "code": "store_unavailable_error",
          "message": "The store is currently unavailable. Try again later."
        }
      ]
    }

Create a rule

This operation creates a rule for the specified account.

This operation creates a rule for the specified account.

This operation creates a rule for the specified account.

This operation creates a rule for the specified account.

This operation creates a rule for the specified account.

POST /v1/rules
(contextBasedRestrictions *ContextBasedRestrictionsV1) CreateRule(createRuleOptions *CreateRuleOptions) (result *Rule, response *core.DetailedResponse, err error)
(contextBasedRestrictions *ContextBasedRestrictionsV1) CreateRuleWithContext(ctx context.Context, createRuleOptions *CreateRuleOptions) (result *Rule, response *core.DetailedResponse, err error)
ServiceCall<Rule> createRule(CreateRuleOptions createRuleOptions)
createRule(params)
create_rule(self,
        *,
        contexts: List['RuleContext'] = None,
        resources: List['Resource'] = None,
        description: str = None,
        enforcement_mode: str = None,
        x_correlation_id: str = None,
        transaction_id: str = None,
        **kwargs
    ) -> DetailedResponse

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action. You can check your access by going to Users > User > Access.

  • cbr.rule.create

Request

Instantiate the CreateRuleOptions struct and set the fields to provide parameter values for the CreateRule method.

Use the CreateRuleOptions.Builder to create a CreateRuleOptions object that contains the parameter values for the createRule method.

Custom Headers

  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression ^[a-zA-Z0-9 ,\-_]+$

The rule to create.

Examples:
View

WithContext method only

The CreateRule options.

The createRule options.

parameters

  • The contexts this rule applies to.

    Possible values: 1 ≤ number of items ≤ 1000

    Examples:
    value
    _source
    _lines
    _html
  • The resources this rule apply to.

    Possible values: number of items = 1

    Examples:
    value
    _source
    _lines
    _html
  • The description of the rule.

    Possible values: 0 ≤ length ≤ 300, Value must match regular expression /^[\\x20-\\xFE]*$/

    Examples:
    value
    _source
    _lines
    _html
  • The rule enforcement mode:

    • enabled - The restrictions are enforced and reported. This is the default.
    • disabled - The restrictions are disabled. Nothing is enforced or reported.
    • report - The restrictions are evaluated and reported, but not enforced.

    Allowable values: [enabled,disabled,report]

    Default: enabled

    Examples:
    value
    _source
    _lines
    _html
  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

parameters

  • The contexts this rule applies to.

    Possible values: 1 ≤ number of items ≤ 1000

    Examples:
    value
    _source
    _lines
    _html
  • The resources this rule apply to.

    Possible values: number of items = 1

    Examples:
    value
    _source
    _lines
    _html
  • The description of the rule.

    Possible values: 0 ≤ length ≤ 300, Value must match regular expression /^[\\x20-\\xFE]*$/

    Examples:
    value
    _source
    _lines
    _html
  • The rule enforcement mode:

    • enabled - The restrictions are enforced and reported. This is the default.
    • disabled - The restrictions are disabled. Nothing is enforced or reported.
    • report - The restrictions are evaluated and reported, but not enforced.

    Allowable values: [enabled,disabled,report]

    Default: enabled

    Examples:
    value
    _source
    _lines
    _html
  • The supplied or generated value of this header is logged for a request and repeated in a response header for the corresponding response. The same value is used for downstream requests and retries of those requests. If a value of this headers is not supplied in a request, the service generates a random (version 4) UUID.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • The Transaction-Id header behaves as the X-Correlation-Id header. It is supported for backward compatibility with other IBM platform services that support the Transaction-Id header only. If both X-Correlation-Id and Transaction-Id are provided, X-Correlation-Id has the precedence over Transaction-Id.

    Possible values: 1 ≤ length ≤ 1024, Value must match regular expression /^[a-zA-Z0-9 ,\\-_]+$/

  • curl -X POST --location --header "Authorization: Bearer {iam_token}"   --header "Accept: application/json"   --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": "65810ac762004f22ac19f8f8edf70a34" } ] } ], "enforcement_mode": "enabled" }'   "{base_url}/v1/rules"
  • ruleContextAttributeModel := &contextbasedrestrictionsv1.RuleContextAttribute{
      Name:  core.StringPtr("networkZoneId"),
      Value: core.StringPtr(zoneID),
    }
    
    ruleContextModel := &contextbasedrestrictionsv1.RuleContext{
      Attributes: []contextbasedrestrictionsv1.RuleContextAttribute{*ruleContextAttributeModel},
    }
    
    resourceModel := &contextbasedrestrictionsv1.Resource{
      Attributes: []contextbasedrestrictionsv1.ResourceAttribute{
        {
          Name:  core.StringPtr("accountId"),
          Value: core.StringPtr(accountID),
        },
        {
          Name:  core.StringPtr("serviceName"),
          Value: core.StringPtr(serviceName),
        },
      },
      Tags: []contextbasedrestrictionsv1.ResourceTagAttribute{
        {
          Name:  core.StringPtr("tagName"),
          Value: core.StringPtr("tagValue"),
        },
      },
    }
    
    createRuleOptions := contextBasedRestrictionsService.NewCreateRuleOptions()
    createRuleOptions.SetDescription("this is an example of rule")
    createRuleOptions.SetContexts([]contextbasedrestrictionsv1.RuleContext{*ruleContextModel})
    createRuleOptions.SetResources([]contextbasedrestrictionsv1.Resource{*resourceModel})
    createRuleOptions.SetEnforcementMode(contextbasedrestrictionsv1.CreateRuleOptionsEnforcementModeEnabledConst)
    rule, response, err := contextBasedRestrictionsService.CreateRule(createRuleOptions)
    if err != nil {
      panic(err)
    }
    b, _ := json.MarshalIndent(rule, "", "  ")
    fmt.Println(string(b))
  • RuleContextAttribute ruleContextAttributeModel = new RuleContextAttribute.Builder()
      .name("networkZoneId")
      .value(zoneID)
      .build();
    RuleContext ruleContextModel = new RuleContext.Builder()
      .attributes(java.util.Arrays.asList(ruleContextAttributeModel))
      .build();
    ResourceAttribute resourceAttributeModelAccountID = new ResourceAttribute.Builder()
      .name("accountId")
      .value(accountID)
      .build();
    ResourceAttribute resourceAttributeModelServiceName = new ResourceAttribute.Builder()
      .name("serviceName")
      .value(serviceName)
      .build();
    ResourceTagAttribute resourceTagAttributeModel = new ResourceTagAttribute.Builder()
      .name("tagName")
      .value("tagValue")
      .build();
    Resource resourceModel = new Resource.Builder()
      .addAttributes(resourceAttributeModelAccountID)
      .addAttributes(resourceAttributeModelServiceName)
      .tags(java.util.Arrays.asList(resourceTagAttributeModel))
      .build();
    CreateRuleOptions createRuleOptions = new CreateRuleOptions.Builder()
      .description("this is an example of rule")
      .addContexts(ruleContextModel)
      .addResources(resourceModel)
      .enforcementMode("enabled")
      .build();
    
    Response<Rule> response = contextBasedRestrictionsService.createRule(createRuleOptions).execute();
    Rule rule = response.getResult();
    
    System.out.println(rule);
    ruleID = rule.getId();
    ruleRev = response.getHeaders().values("Etag").get(0);
  • // Request models needed by this operation.
    
    // RuleContextAttribute
    const ruleContextAttributeModel = {
      name: 'networkZoneId',
      value: zoneId,
    };
    
    // RuleContext
    const ruleContextModel = {
      attributes: [ruleContextAttributeModel],
    };
    
    // ResourceAttribute
    const resourceAttributeAccountIdModel = {
      name: 'accountId',
      value: accountId,
    };
    
    // Resource Attribute
    const resourceAttributeServiceNameModel = {
      name: 'serviceName',
      value: serviceName,
      operator: 'stringEquals',
    };
    
    // Resource
    const resourceModel = {
      attributes: [resourceAttributeAccountIdModel, resourceAttributeServiceNameModel],
    };
    
    const params = {
      contexts: [ruleContextModel],
      resources: [resourceModel],
      description: 'this is an example of rule',
      enforcementMode: 'enabled',
    };
    
    try {
      const res = await contextBasedRestrictionsService.createRule(params);
      ruleId = res.result.id;
      ruleRev = res.headers.etag;
      console.log(JSON.stringify(res.result, null, 2));
    } catch (err) {
      console.warn(err);
    }
  • rule_context_attribute_model = {
      'name': 'networkZoneId',
      'value': zone_id,
    }
    
    rule_context_model = {
      'attributes': [rule_context_attribute_model],
    }
    
    resource_attribute_account_id_model = {
      'name': 'accountId',
      'value': account_id,
    }
    
    resource_attribute_service_name_model = {
      'name': 'serviceName',
      'value': service_name,
    }
    
    resource_model = {
      'attributes': [resource_attribute_account_id_model, resource_attribute_service_name_model],
    }
    
    rule = context_based_restrictions_service.create_rule(
      contexts=[rule_context_model],
      resources=[resource_model],
      description='this is an example of rule',
      enforcement_mode='enabled'
    ).get_result()
    
    print(json.dumps(rule, indent=2))

Response

An output rule

An output rule.

An output rule.

An output rule.

An output rule.