/mgmt/shared/iapp/block-configuration-tasks

The Block Configuration Task Collection Worker (BCTCW) is the part of iApps® LX infrastructure used for interacting with configuration processors. This task collection worker checks the availability of configuration processor, send BINDING or UNBINDING event to config processor, receives the response back from configuration processor and finally updates the iApps LX block with the status received. It is responsibility of this worker to make sure only one configuration task is run for a block at any point of time. In case configuration processor does not respond within specified time out duration, this worker is responsible for updating the block with error state and appropriate message.


Important

The only interation a user or developer should have with this API is from an iApp LX proccesor in the fashion outlined in the section iApps LX Framework Contracts.


Action: Update a block configuration task from the config proccesor

Update the block configuration task with the status of creation/deletion of configuration managed by given application block. Configuration processors need to save and use original selfLink or id off the initial configuration task request. Additionally this update operation is like any other iControl REST requests and configuration processor should include proper authentication headers in the REST request. Typically configuration processors can save authorization from initial task request and reuse when updating the iApps LX subsystem.

URI Path HTTP Method
/mgmt/shared/iapp/block-configuration-tasks/<task_UUID> PATCH

Data Parameters

Send back the onPost request body back to the config task with the updated block state and task subStatus properties (highlighted below).

{
  "block": {
    "id": "4a3df10c-ee55-4e95-992f-edbef8bd9e43",
    //<---------- Truncated block properties here------------>
    "state": "BOUND",
    "selfLink": "https://localhost/mgmt/shared/iapp/blocks/4a3df10c-ee55-4e95-992f-edbef8bd9e43"
  },
  "subStatus": "UPDATE_BLOCK_WITH_RESPONSE",
  //<----------- Truncated task properties here------------>
}

The task attribute must always be UPDATE_BLOCK_WITH_RESPONSE. The state attribute can be one of the following:

State Value Description
BOUND The response state to a sucessful onPost event in the config proccesor.
UNBOUND The response state to a sucessful onDelete event in the config proccesor.
ERROR The response state to an unsucessful onPost or onDelete event in the config proccesor.

For a call to the set the block state as ERROR you also need to include the error attribute in the block as shown here:

{
  "block": {
    "id": "4a3df10c-ee55-4e95-992f-edbef8bd9e43",
    //<---------- Truncated block properties here------------>
    "state":"ERROR",
    "error":"Failed to create virtual server with port 9445",
    "selfLink": "https://localhost/mgmt/shared/iapp/blocks/4a3df10c-ee55-4e95-992f-edbef8bd9e43"
  },
  "subStatus": "UPDATE_BLOCK_WITH_RESPONSE",
  //<----------- Truncated task properties here------------>
}

Success Response

HTTP/1.1 200 OK
{
  "block": {
    "id": "4a3df10c-ee55-4e95-992f-edbef8bd9e43",
    "name": "HTTP test",
    "inputProperties": [
      {
        "id": "virtualAddress",
        "type": "STRING",
        "value": "10.0.0.25",
        "metaData": {
          "description": "Virtual Server IP address, either IPv4 or IPv6",
          "displayName": "Virtual Server IP",
          "isRequired": true
        }
      }
    ],
    "configurationProcessorReference": {
      "link": "https://localhost/mgmt/shared/iapp/noop"
    },
    "configProcessorTimeoutSeconds": 30,
    "statsProcessorTimeoutSeconds": 15,
    "configProcessorAffinity": {
      "processorPolicy": "LOAD_BALANCED",
      "affinityProcessorReference": {
        "link": "https://localhost/mgmt/shared/iapp/processors/affinity/load-balanced"
      }
    },
    "state": "BOUND",
    "generation": 5,
    "lastUpdateMicros": 1518666492189229,
    "kind": "shared:iapp:blocks:blockstate",
    "selfLink": "https://localhost/mgmt/shared/iapp/blocks/4a3df10c-ee55-4e95-992f-edbef8bd9e43"
  },
  "subStatus": "UPDATE_BLOCK_WITH_RESPONSE",
  "id": "61c13919-3f40-4b00-bfb2-99b11c71a39a",
  "status": "STARTED",
  "startTime": "2018-02-14T19:48:12.197-0800",
  "userReference": {
    "link": "https://localhost/mgmt/shared/authz/users/admin"
  },
  "identityReferences": [
    {
      "link": "https://localhost/mgmt/shared/authz/users/admin"
    }
  ],
  "ownerMachineId": "44e002f8-c5e9-49b5-aed4-67a4e79c1b6b",
  "generation": 4,
  "lastUpdateMicros": 1518666492222462,
  "kind": "shared:iapp:block-configuration-tasks:blockconfigurationtaskstate",
  "selfLink": "https://localhost/mgmt/shared/iapp/block-configuration-tasks/61c13919-3f40-4b00-bfb2-99b11c71a39a"
}

Error Response

Unauthorized

HTTP/1.1 401 Unauthorized

Item not found

HTTP/1.1 404 Not Found

Example Call

Example in config processor:

MyConfigProcessor.prototype.onPost = function(restOperation) {
  let configTaskState = restOperation.getBody();

  let auth = restOperation.getBasicAuthorization();

  // Indicate the iApps LX platform configuration request is accepted.
  this.completeRequest(restOperation, this.wellKnownPorts.STATUS_ACCEPTED);

  // Some type of config code in this area

  // Prepare the PATH to the BCTCW API
  configTaskState.subStatus = 'UPDATE_BLOCK_WITH_RESPONSE';
  configTaskState.block.state = 'BOUND';

  let restOp = this.restOperationFactory.createRestOperationInstance()
    .setUri(this.restHelper.makeRestjavdUriFromSelfLink(configTaskState.selfLink))
    .setIsSetBasicAuthHeader(!!auth)
    .setBasicAuthorization(auth)
    .setReferer(this.getUri().href)
    .setBody(configTaskState);

  this.restRequestSender.sendPatch(restOp);
};