blob: 87f0ec6fa32f3af024ccb5d3e9a966cb1448d54f [file] [log] [blame]
liamfallone206a102021-10-07 19:00:18 +01001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2
3.. _clamp-controlloop-http-participant:
4
5HTTP Participant
6################
7
8.. warning:: To be completed
9
10The CLAMP HTTP participant receives configuration information from the CLAMP runtime,
11maps the configuration information to a REST URL, and makes a REST call on the URL.
12Typically the HTTP Participant is used with another participant such as the
13:ref:`Kubernetes Participant <clamp-controlloop-k8s-participant>`, which brings up
14the microservice that runs a REST server. Once the microservice is up, the HTTP
15participant can be used to configure the microservice over its REST interface.Of course,
16the HTTP participant works towards any REST service, it is not restricted to REST
17services started by participants.
18
19.. image:: ../../images/participants/http-participant.png
20
21The HTTP participant runs a Control Loop Element to handle the REST dialogues for a
22particular application domain. The REST dialogues are whatever REST calls that are
23required to implement the functionality for the application domain.
24
25The HTTP participant allows the REST dialogues for a Control Loop to be managed. A
26particular Control Loop may require many *things* to be configured and managed and this
27may require many REST dialogues to achieve.
28
29A *Configuration Entity* describes a concept that is managed by the HTTP participant. A
30Configuration Entity can be created, Read, Updated, and Deleted (CRUD). The user defines
31the Configuration Entities that it wants its HTTP Control Loop Element to manage and
32provides a sequence of parameterized REST commands to Create, Read, Update, and Delete
33each Configuration Entity.
34
35When a control loop is initialized, the HTTP participant starts a HTTP Control Loop
36element for the control loop. It reads the configuration information sent from the
37Control Loop Runtime runs a HTTP client to talk to the REST endpoint that is receiving
38the REST requests. A HTTP participant can simultaneously manage HTTP Control Loop
39Elements towards multiple REST endpoints, as shown in the diagram above where the HTTP
40participant is running two HTTP Control Loop Elements, one for Control Loop A and one for
41Control Loop B.
42
43Configuring a Control Loop Element on the HTTP participant for a Control Loop
44-----------------------------------------------------------------------------
45
46The user configures the following properties in the CLAMP GUI for the HTTP participant:
47
48.. list-table::
49 :widths: 15 10 50
50 :header-rows: 1
51
52 * - Property
53 - Type
54 - Description
55 * - baseUrl
56 - URL
57 - A well formed URL pointing at the REST server that is processing the REST requests
58 * - httpHeaders
59 - map
60 - A map of *<String, String>* defining the HTTP headers to send on all REST calls
61 * - configurationEntitiies
62 - map
63 - A map of *<String, ConfigurationEntity>* describing the names and definitions of
64 configuration entities that are managed by this HTTP Control Loop Element
65
66The *ConfigurationEntity* type is described in the following table:
67
68.. list-table::
69 :widths: 15 10 50
70 :header-rows: 1
71
72 * - Field
73 - Type
74 - Description
75 * - ID
76 - ToscaConceptIdentifier
77 - The name and version of the Configuration Entity
78 * - restSequence
79 - List<RestRequest>
80 - A list of REST requests to give manage the Configuration Entity
81
82The *RestRequest* type is described in the following table:
83
84.. list-table::
85 :widths: 15 10 50
86 :header-rows: 1
87
88 * - Field
89 - Type
90 - Description
91 * - httpMethod
92 - HttpMethod
93 - An enum for the HTTP method {GET, PUT, POST, DELETE}
94 * - path
95 - String
96 - The path of the REST endopint relative to the baseUrl
97 * - body
98 - String
99 - The body of the request for POST and PUT methods
100 * - expectedResponse
101 - HttpStatus
102 - The expected HTTP response code fo the REST request
103