Changed the API document generation to use swagger3.
Change-Id: I130b611735e11b0104e0c69c63025786d51a9ed6
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Issue-ID: NONRTRIC-415
{
- "basePath": "/",
+ "components": {"schemas": {
+ "producer_ei_job_request": {
+ "description": "The body of the EI producer callbacks for EI job creation and deletion",
+ "type": "object",
+ "required": ["ei_job_identity"],
+ "properties": {
+ "owner": {
+ "description": "The owner of the job",
+ "type": "string"
+ },
+ "ei_job_identity": {
+ "description": "Idenitity of the EI job",
+ "type": "string"
+ },
+ "last_updated": {
+ "description": "The time when the job was last updated or created (ISO-8601)",
+ "type": "string"
+ },
+ "ei_job_data": {
+ "description": "Json for the job data",
+ "type": "object"
+ },
+ "target_uri": {
+ "description": "URI for the target of the EI",
+ "type": "string"
+ },
+ "ei_type_identity": {
+ "description": "Type idenitity for the job",
+ "type": "string"
+ }
+ }
+ },
+ "EiTypeObject": {
+ "description": "Information for an EI type",
+ "type": "object"
+ },
+ "status_info": {
+ "type": "object",
+ "required": [
+ "no_of_jobs",
+ "no_of_producers",
+ "no_of_types",
+ "status"
+ ],
+ "properties": {
+ "no_of_producers": {
+ "format": "int32",
+ "description": "Number of EI producers",
+ "type": "integer"
+ },
+ "no_of_types": {
+ "format": "int32",
+ "description": "Number of EI types",
+ "type": "integer"
+ },
+ "no_of_jobs": {
+ "format": "int32",
+ "description": "Number of EI jobs",
+ "type": "integer"
+ },
+ "status": {
+ "description": "status text",
+ "type": "string"
+ }
+ }
+ },
+ "producer_ei_type_info": {
+ "description": "Information for an EI type",
+ "type": "object",
+ "required": ["ei_job_data_schema"],
+ "properties": {"ei_job_data_schema": {
+ "description": "Json schema for the job data",
+ "type": "object"
+ }}
+ },
+ "producer_registration_info": {
+ "description": "Information for an EI producer",
+ "type": "object",
+ "required": [
+ "ei_job_callback_url",
+ "ei_producer_supervision_callback_url",
+ "supported_ei_types"
+ ],
+ "properties": {
+ "supported_ei_types": {
+ "description": "Supported EI type IDs",
+ "type": "array",
+ "items": {
+ "description": "Supported EI type IDs",
+ "type": "string"
+ }
+ },
+ "ei_producer_supervision_callback_url": {
+ "description": "callback for producer supervision",
+ "type": "string"
+ },
+ "ei_job_callback_url": {
+ "description": "callback for EI job",
+ "type": "string"
+ }
+ }
+ },
+ "producer_status": {
+ "description": "Status for an EI Producer",
+ "type": "object",
+ "required": ["operational_state"],
+ "properties": {"operational_state": {
+ "description": "Represents the operational states",
+ "type": "string",
+ "enum": [
+ "ENABLED",
+ "DISABLED"
+ ]
+ }}
+ },
+ "ProblemDetails": {
+ "description": "A problem detail to carry details in a HTTP response according to RFC 7807",
+ "type": "object",
+ "properties": {
+ "detail": {
+ "description": "A human-readable explanation specific to this occurrence of the problem.",
+ "type": "string",
+ "example": "EI job type not found"
+ },
+ "status": {
+ "format": "int32",
+ "description": "The HTTP status code generated by the origin server for this occurrence of the problem.",
+ "type": "integer",
+ "example": 404
+ }
+ }
+ },
+ "Void": {
+ "description": "Void/empty ",
+ "type": "object"
+ },
+ "EiJobStatusObject": {
+ "description": "Status for an EI job",
+ "type": "object",
+ "required": ["eiJobStatus"],
+ "properties": {"eiJobStatus": {
+ "description": "Allowed values for EI job status",
+ "type": "string",
+ "enum": [
+ "ENABLED",
+ "DISABLED"
+ ]
+ }}
+ },
+ "EiJobObject": {
+ "description": "Information for an Enrichment Information Job",
+ "type": "object",
+ "required": [
+ "eiTypeId",
+ "jobDefinition",
+ "jobOwner",
+ "jobResultUri"
+ ],
+ "properties": {
+ "eiTypeId": {
+ "description": "EI type Idenitifier of the EI job",
+ "type": "string"
+ },
+ "jobResultUri": {
+ "description": "The target URI of the EI data",
+ "type": "string"
+ },
+ "jobOwner": {
+ "description": "Identity of the owner of the job",
+ "type": "string"
+ },
+ "statusNotificationUri": {
+ "description": "The target of EI job status notifications",
+ "type": "string"
+ },
+ "jobDefinition": {
+ "description": "EI type specific job data",
+ "type": "object"
+ }
+ }
+ }
+ }},
+ "openapi": "3.0.1",
"paths": {
"/producer_simulator/ei_job": {"post": {
- "summary": "Callback for EI job creation",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "jobCreatedCallbackUsingPOST",
- "responses": {
- "200": {"description": "OK"},
- "201": {"description": "Created"},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "parameters": [{
- "schema": {"$ref": "#/definitions/producer_ei_job_request"},
- "in": "body",
- "name": "request",
- "description": "request",
+ "summary": "Callback for EI job creation/modification",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_ei_job_request"}}},
"required": true
- }],
- "tags": ["Data Producer Job Control (example producer)"],
- "consumes": ["application/json"]
+ },
+ "description": "The call is invoked to activate or to modify a data subscription. The endpoint is provided by the EI producer.",
+ "operationId": "jobCreatedCallback",
+ "responses": {"200": {
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ }},
+ "tags": ["Data producer (callbacks)"]
}},
"/A1-EI/v1/eitypes/{eiTypeId}": {"get": {
"summary": "Individual EI type",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getEiTypeUsingGET",
+ "operationId": "getEiType_1",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/EiTypeObject"},
- "description": "EI type"
+ "description": "EI type",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiTypeObject"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information type is not found"
+ "description": "Enrichment Information type is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiTypeId",
- "description": "eiTypeId",
- "type": "string",
"required": true
}],
- "tags": ["A1-EI (enrichment information)"]
- }},
- "/consumer_simulator/eijobs/{eiJobId}/status": {"post": {
- "summary": "Callback for EI job status",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "jobStatusCallbackUsingPOST",
- "responses": {
- "200": {"description": "OK"},
- "201": {"description": "Created"},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "parameters": [
- {
- "in": "path",
- "name": "eiJobId",
- "description": "eiJobId",
- "type": "string",
- "required": true
- },
- {
- "schema": {"$ref": "#/definitions/EiJobStatusObject"},
- "in": "body",
- "name": "status",
- "description": "status",
- "required": true
- }
- ],
- "tags": ["A1-EI (enrichment information) callbacks"],
- "consumes": ["application/json"]
+ "tags": ["A1-EI (registration)"]
}},
"/ei-producer/v1/eitypes": {"get": {
"summary": "EI type identifiers",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getEiTypeIdentifiersUsingGET_1",
- "responses": {
- "200": {
- "schema": {
- "type": "array",
- "items": {"type": "string"}
- },
- "description": "EI type identifiers"
- },
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "tags": ["Data Producer Registry API"]
+ "operationId": "getEiTypeIdentifiers",
+ "responses": {"200": {
+ "description": "EI type identifiers",
+ "content": {"application/json": {"schema": {
+ "type": "array",
+ "items": {"type": "string"}
+ }}}
+ }},
+ "tags": ["Data producer (registration)"]
}},
"/A1-EI/v1/eitypes": {"get": {
"summary": "EI type identifiers",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getEiTypeIdentifiersUsingGET",
- "responses": {
- "200": {
- "schema": {
- "type": "array",
- "items": {"type": "string"}
- },
- "description": "EI type identifiers"
- },
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "tags": ["A1-EI (enrichment information)"]
+ "operationId": "getEiTypeIdentifiers_1",
+ "responses": {"200": {
+ "description": "EI type identifiers",
+ "content": {"application/json": {"schema": {
+ "type": "array",
+ "items": {"type": "string"}
+ }}}
+ }},
+ "tags": ["A1-EI (registration)"]
}},
"/ei-producer/v1/eiproducers/{eiProducerId}/status": {"get": {
"summary": "EI producer status",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getEiProducerStatusUsingGET",
+ "operationId": "getEiProducerStatus",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/producer_status"},
- "description": "EI producer status"
+ "description": "EI producer status",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_status"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information producer is not found"
+ "description": "Enrichment Information producer is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiProducerId",
- "description": "eiProducerId",
- "type": "string",
"required": true
}],
- "tags": ["Data Producer Registry API"]
+ "tags": ["Data producer (registration)"]
}},
"/producer_simulator/ei_job/{eiJobId}": {"delete": {
"summary": "Callback for EI job deletion",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "jobDeletedCallbackUsingDELETE",
- "responses": {
- "200": {"description": "OK"},
- "401": {"description": "Unauthorized"},
- "204": {"description": "No Content"},
- "403": {"description": "Forbidden"}
- },
+ "description": "The call is invoked to terminate a data subscription. The endpoint is provided by the EI producer.",
+ "operationId": "jobDeletedCallback",
+ "responses": {"200": {
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ }},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiJobId",
- "description": "eiJobId",
- "type": "string",
"required": true
}],
- "tags": ["Data Producer Job Control (example producer)"]
- }},
- "/ei-producer/v1/eiproducers": {"get": {
- "summary": "EI producer identifiers",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getEiProducerIdentifiersUsingGET",
- "responses": {
- "200": {
- "schema": {
- "type": "array",
- "items": {"type": "string"}
- },
- "description": "EI producer identifiers"
- },
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "parameters": [{
- "in": "query",
- "allowEmptyValue": false,
- "name": "ei_type_id",
- "description": "If given, only the producers for the EI Data type is returned.",
- "type": "string",
- "required": false
- }],
- "tags": ["Data Producer Registry API"]
+ "tags": ["Data producer (callbacks)"]
}},
"/ei-producer/v1/eitypes/{eiTypeId}": {
"get": {
"summary": "Individual EI type",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getEiTypeUsingGET_1",
+ "operationId": "getEiType",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/producer_ei_type_info"},
- "description": "EI type"
+ "description": "EI type",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_ei_type_info"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information type is not found"
+ "description": "Enrichment Information type is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiTypeId",
- "description": "eiTypeId",
- "type": "string",
"required": true
}],
- "tags": ["Data Producer Registry API"]
+ "tags": ["Data producer (registration)"]
},
"delete": {
"summary": "Individual EI type",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "deleteEiTypeUsingDELETE",
+ "operationId": "deleteEiType",
"responses": {
- "200": {"description": "Not used"},
- "401": {"description": "Unauthorized"},
- "204": {"description": "Producer deleted"},
- "403": {"description": "Forbidden"},
+ "200": {
+ "description": "Not used",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
+ "204": {
+ "description": "Producer deleted",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information type is not found"
+ "description": "Enrichment Information type is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
},
"406": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "The Enrichment Information type has one or several active producers"
+ "description": "The Enrichment Information type has one or several active producers",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiTypeId",
- "description": "eiTypeId",
- "type": "string",
"required": true
}],
- "tags": ["Data Producer Registry API"]
+ "tags": ["Data producer (registration)"]
},
"put": {
"summary": "Individual EI type",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "putEiTypeUsingPUT",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_ei_type_info"}}},
+ "required": true
+ },
+ "operationId": "putEiType",
"responses": {
- "200": {"description": "Type updated"},
- "201": {"description": "Type created"},
- "400": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Bad request"
+ "200": {
+ "description": "Type updated",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "parameters": [
- {
- "in": "path",
- "name": "eiTypeId",
- "description": "eiTypeId",
- "type": "string",
- "required": true
+ "201": {
+ "description": "Type created",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
- {
- "schema": {"$ref": "#/definitions/producer_ei_type_info"},
- "in": "body",
- "name": "registrationInfo",
- "description": "registrationInfo",
- "required": true
+ "400": {
+ "description": "Bad request",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
- ],
- "tags": ["Data Producer Registry API"],
- "consumes": ["application/json"]
+ },
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "eiTypeId",
+ "required": true
+ }],
+ "tags": ["Data producer (registration)"]
}
},
"/status": {"get": {
"summary": "Returns status and statistics of this service",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getStatusUsingGET",
- "responses": {
- "200": {
- "schema": {"$ref": "#/definitions/status_info"},
- "description": "Service is living"
- },
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "tags": ["Service status"]
+ "operationId": "getStatus",
+ "responses": {"200": {
+ "description": "Service is living",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/status_info"}}}
+ }},
+ "tags": ["EI Service status"]
+ }},
+ "/ei-producer/v1/eiproducers": {"get": {
+ "summary": "EI producer identifiers",
+ "operationId": "getEiProducerIdentifiers",
+ "responses": {"200": {
+ "description": "EI producer identifiers",
+ "content": {"application/json": {"schema": {
+ "type": "array",
+ "items": {"type": "string"}
+ }}}
+ }},
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "query",
+ "name": "ei_type_id",
+ "description": "If given, only the producers for the EI Data type is returned.",
+ "required": false
+ }],
+ "tags": ["Data producer (registration)"]
}},
"/A1-EI/v1/eijobs/{eiJobId}": {
"get": {
"summary": "Individual EI job",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getIndividualEiJobUsingGET",
+ "operationId": "getIndividualEiJob",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/EiJobObject"},
- "description": "EI job"
+ "description": "EI job",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiJobObject"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information job is not found"
+ "description": "Enrichment Information job is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiJobId",
- "description": "eiJobId",
- "type": "string",
"required": true
}],
- "tags": ["A1-EI (enrichment information)"]
+ "tags": ["A1-EI (registration)"]
},
"delete": {
"summary": "Individual EI job",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "deleteIndividualEiJobUsingDELETE",
+ "operationId": "deleteIndividualEiJob",
"responses": {
- "200": {"description": "Not used"},
- "401": {"description": "Unauthorized"},
- "204": {"description": "Job deleted"},
- "403": {"description": "Forbidden"},
+ "200": {
+ "description": "Not used",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
+ "204": {
+ "description": "Job deleted",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information job is not found"
+ "description": "Enrichment Information job is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiJobId",
- "description": "eiJobId",
- "type": "string",
"required": true
}],
- "tags": ["A1-EI (enrichment information)"]
+ "tags": ["A1-EI (registration)"]
},
"put": {
"summary": "Individual EI job",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "putIndividualEiJobUsingPUT",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiJobObject"}}},
+ "required": true
+ },
+ "operationId": "putIndividualEiJob",
"responses": {
- "200": {"description": "Job updated"},
- "201": {"description": "Job created"},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
+ "200": {
+ "description": "Job updated",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
+ "201": {
+ "description": "Job created",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information type is not found"
+ "description": "Enrichment Information type is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
- "parameters": [
- {
- "in": "path",
- "name": "eiJobId",
- "description": "eiJobId",
- "type": "string",
- "required": true
- },
- {
- "schema": {"$ref": "#/definitions/EiJobObject"},
- "in": "body",
- "name": "eiJobObject",
- "description": "eiJobObject",
- "required": true
- }
- ],
- "tags": ["A1-EI (enrichment information)"],
- "consumes": ["application/json"]
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "eiJobId",
+ "required": true
+ }],
+ "tags": ["A1-EI (registration)"]
}
},
"/ei-producer/v1/eiproducers/{eiProducerId}": {
"get": {
"summary": "Individual EI producer",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getEiProducerUsingGET",
+ "operationId": "getEiProducer",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/producer_registration_info"},
- "description": "EI producer"
+ "description": "EI producer",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_registration_info"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information producer is not found"
+ "description": "Enrichment Information producer is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiProducerId",
- "description": "eiProducerId",
- "type": "string",
"required": true
}],
- "tags": ["Data Producer Registry API"]
+ "tags": ["Data producer (registration)"]
},
"delete": {
"summary": "Individual EI producer",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "deleteEiProducerUsingDELETE",
+ "operationId": "deleteEiProducer",
"responses": {
- "200": {"description": "Not used"},
- "401": {"description": "Unauthorized"},
- "204": {"description": "Producer deleted"},
- "403": {"description": "Forbidden"},
+ "200": {
+ "description": "Not used",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
+ "204": {
+ "description": "Producer deleted",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ },
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Producer is not found"
+ "description": "Producer is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiProducerId",
- "description": "eiProducerId",
- "type": "string",
"required": true
}],
- "tags": ["Data Producer Registry API"]
+ "tags": ["Data producer (registration)"]
},
"put": {
"summary": "Individual EI producer",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "putEiProducerUsingPUT",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_registration_info"}}},
+ "required": true
+ },
+ "operationId": "putEiProducer",
"responses": {
- "200": {"description": "Producer updated"},
- "201": {"description": "Producer created"},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "parameters": [
- {
- "in": "path",
- "name": "eiProducerId",
- "description": "eiProducerId",
- "type": "string",
- "required": true
+ "200": {
+ "description": "Producer updated",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
- {
- "schema": {"$ref": "#/definitions/producer_registration_info"},
- "in": "body",
- "name": "registrationInfo",
- "description": "registrationInfo",
- "required": true
+ "201": {
+ "description": "Producer created",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
}
- ],
- "tags": ["Data Producer Registry API"],
- "consumes": ["application/json"]
+ },
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "eiProducerId",
+ "required": true
+ }],
+ "tags": ["Data producer (registration)"]
}
},
"/producer_simulator/health_check": {"get": {
"summary": "Producer supervision",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "producerSupervisionUsingGET",
- "responses": {
- "200": {
- "schema": {"type": "string"},
- "description": "OK"
- },
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "tags": ["Data Producer Job Control (example producer)"]
+ "description": "The endpoint is provided by the EI producer and is used for supervision of the producer.",
+ "operationId": "producerSupervision",
+ "responses": {"200": {
+ "description": "The producer is OK",
+ "content": {"application/json": {"schema": {"type": "string"}}}
+ }},
+ "tags": ["Data producer (callbacks)"]
}},
"/ei-producer/v1/eiproducers/{eiProducerId}/eijobs": {"get": {
"summary": "EI job definitions",
- "deprecated": false,
- "produces": ["application/json"],
"description": "EI job definitions for one EI producer",
- "operationId": "getEiProducerJobsUsingGET",
+ "operationId": "getEiProducerJobs",
"responses": {
"200": {
- "schema": {
+ "description": "EI producer",
+ "content": {"application/json": {"schema": {
"type": "array",
- "items": {"$ref": "#/definitions/producer_ei_job_request"}
- },
- "description": "EI producer"
+ "items": {"$ref": "#/components/schemas/producer_ei_job_request"}
+ }}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information producer is not found"
+ "description": "Enrichment Information producer is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiProducerId",
- "description": "eiProducerId",
- "type": "string",
"required": true
}],
- "tags": ["Data Producer Registry API"]
+ "tags": ["Data producer (registration)"]
}},
"/A1-EI/v1/eijobs": {"get": {
"summary": "EI job identifiers",
- "deprecated": false,
- "produces": ["application/json"],
"description": "query for EI job identifiers",
- "operationId": "getEiJobIdsUsingGET",
+ "operationId": "getEiJobIds",
"responses": {
"200": {
- "schema": {
+ "description": "EI job identifiers",
+ "content": {"application/json": {"schema": {
"type": "array",
"items": {"type": "string"}
- },
- "description": "EI job identifiers"
+ }}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information type is not found"
+ "description": "Enrichment Information type is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "eiTypeId",
"description": "selects EI jobs of matching EI type",
- "type": "string",
"required": false
},
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "owner",
"description": "selects EI jobs for one EI job owner",
- "type": "string",
"required": false
}
],
- "tags": ["A1-EI (enrichment information)"]
+ "tags": ["A1-EI (registration)"]
}},
"/A1-EI/v1/eijobs/{eiJobId}/status": {"get": {
"summary": "EI job status",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getEiJobStatusUsingGET",
+ "operationId": "getEiJobStatus",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/EiJobStatusObject"},
- "description": "EI job status"
+ "description": "EI job status",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiJobStatusObject"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/ProblemDetails"},
- "description": "Enrichment Information job is not found"
+ "description": "Enrichment Information job is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "eiJobId",
- "description": "eiJobId",
- "type": "string",
"required": true
}],
- "tags": ["A1-EI (enrichment information)"]
+ "tags": ["A1-EI (registration)"]
+ }},
+ "/example_dataconsumer/eijobs/{eiJobId}/status": {"post": {
+ "summary": "Callback for changed EI job status",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiJobStatusObject"}}},
+ "required": true
+ },
+ "description": "The primitive is implemented by the data consumer and is invoked when a EI job status has been changed.",
+ "operationId": "jobStatusCallback",
+ "responses": {"200": {
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ }},
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "eiJobId",
+ "required": true
+ }],
+ "tags": ["A1-EI (callbacks)"]
}}
},
- "definitions": {
- "producer_ei_job_request": {
- "description": "The body of the EI producer callbacks for EI job creation and deletion",
- "type": "object",
- "title": "producer_ei_job_request",
- "required": ["ei_job_identity"],
- "properties": {
- "owner": {
- "description": "The owner of the job",
- "type": "string"
- },
- "ei_job_identity": {
- "description": "Idenitity of the EI job",
- "type": "string"
- },
- "last_updated": {
- "description": "The time when the job was last updated or created (ISO-8601)",
- "type": "string"
- },
- "ei_job_data": {
- "description": "Json for the job data",
- "type": "object"
- },
- "target_uri": {
- "description": "URI for the target of the EI",
- "type": "string"
- },
- "ei_type_identity": {
- "description": "Type idenitity for the job",
- "type": "string"
- }
- }
- },
- "EiTypeObject": {
- "description": "Information for an EI type",
- "type": "object",
- "title": "EiTypeObject"
- },
- "status_info": {
- "type": "object",
- "title": "status_info",
- "properties": {
- "no_of_producers": {
- "format": "int32",
- "description": "Number of EI producers",
- "type": "integer"
- },
- "no_of_jobs": {
- "format": "int32",
- "description": "Number of EI jobs",
- "type": "integer"
- },
- "no_of_types": {
- "format": "int32",
- "description": "Number of EI types",
- "type": "integer"
- },
- "status": {
- "description": "status text",
- "type": "string"
- }
- }
- },
- "producer_ei_type_info": {
- "description": "Information for an EI type",
- "type": "object",
- "title": "producer_ei_type_info",
- "required": ["ei_job_data_schema"],
- "properties": {"ei_job_data_schema": {
- "description": "Json schema for the job data",
- "type": "object"
- }}
- },
- "producer_registration_info": {
- "description": "Information for an EI producer",
- "type": "object",
- "title": "producer_registration_info",
- "required": [
- "ei_job_callback_url",
- "ei_producer_supervision_callback_url",
- "supported_ei_types"
- ],
- "properties": {
- "supported_ei_types": {
- "description": "Supported EI type IDs",
- "type": "array",
- "items": {"type": "string"}
- },
- "ei_producer_supervision_callback_url": {
- "description": "callback for producer supervision",
- "type": "string"
- },
- "ei_job_callback_url": {
- "description": "callback for EI job",
- "type": "string"
- }
- }
- },
- "producer_status": {
- "description": "Status for an EI Producer",
- "type": "object",
- "title": "producer_status",
- "required": ["operational_state"],
- "properties": {"operational_state": {
- "description": "Operational state, values:\nENABLED: TBD\nDISABLED: TBD.",
- "type": "string",
- "enum": [
- "ENABLED",
- "DISABLED"
- ]
- }}
- },
- "ProblemDetails": {
- "description": "A problem detail to carry details in a HTTP response according to RFC 7807",
- "type": "object",
- "title": "ProblemDetails",
- "properties": {
- "detail": {
- "description": "A human-readable explanation specific to this occurrence of the problem.",
- "type": "string",
- "example": "EI job type not found"
- },
- "status": {
- "format": "int32",
- "description": "The HTTP status code generated by the origin server for this occurrence of the problem.",
- "type": "integer",
- "example": 404
- }
- }
- },
- "EiJobStatusObject": {
- "description": "Status for an EI job",
- "type": "object",
- "title": "EiJobStatusObject",
- "required": ["eiJobStatus"],
- "properties": {"eiJobStatus": {
- "description": "values:\nENABLED: the A1-EI producer is able to deliver EI result for the EI job\nDISABLED: the A1-EI producer is unable to deliver EI result for the EI job",
- "type": "string",
- "enum": [
- "ENABLED",
- "DISABLED"
- ]
- }}
- },
- "EiJobObject": {
- "description": "Information for an Enrichment Information Job",
- "type": "object",
- "title": "EiJobObject",
- "required": [
- "eiTypeId",
- "jobDefinition",
- "jobOwner",
- "jobResultUri"
- ],
- "properties": {
- "eiTypeId": {
- "description": "EI type Idenitifier of the EI job",
- "type": "string"
- },
- "jobResultUri": {
- "description": "The target URI of the EI data",
- "type": "string"
- },
- "jobOwner": {
- "description": "Identity of the owner of the job",
- "type": "string"
- },
- "jobStatusNotificationUri": {
- "description": "The target of EI job status notifications",
- "type": "string"
- },
- "jobDefinition": {
- "description": "EI type specific job data",
- "type": "object"
- }
- }
- }
- },
- "swagger": "2.0",
"info": {
- "description": "This page lists all the rest apis for the service.",
- "title": "Enrichment Data service",
+ "license": {
+ "name": "Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.",
+ "url": "http://www.apache.org/licenses/LICENSE-2.0"
+ },
+ "description": "<h1>API documentation<\/h1><h2>General<\/h2><p> The service is mainly a broker between data producers and data consumers. A data producer has the ability to producer one or several type of data (EI type). One type of data can be produced by zero to many producers. <br /><br />A data consumer can have several active data subscriptions (EI job). One EI job consists of the the type of data to produce and additional parameters for filtering of the data. These parameters are different for different data types.<\/p><h2>APIs provided by the service<\/h2><h4>A1-EI<\/h4><p> This API is between Near-RT RIC, which is a data consumer and the Non-RT RIC. <\/p><h4>Data producer API<\/h4><p> This API is between data producers and this service. It is divivided into two parts, where one is provided by this service (registration) and one part is provided by the data producer.<\/p><h4>EI Service status<\/h4><p> This API provides a means to monitor the service.<\/p>",
+ "title": "Enrichment Information Service",
"version": "1.0"
},
"tags": [
{
- "name": "A1-EI (enrichment information)",
- "description": "Consumer Controller"
+ "name": "A1-EI (registration)",
+ "description": "Data consumer EI job registration"
},
{
- "name": "A1-EI (enrichment information) callbacks",
- "description": "Consumer Simulator Controller"
+ "name": "A1-EI (callbacks)",
+ "description": "Data consumer EI job status callbacks"
},
{
- "name": "Data Producer Job Control (example producer)",
- "description": "Producer Simulator Controller"
+ "name": "Data producer (callbacks)",
+ "description": "API implemented by data producers"
},
{
- "name": "Data Producer Registry API",
- "description": "Producer Controller"
+ "name": "Data producer (registration)",
+ "description": "API for data producers"
},
{
- "name": "Service status",
- "description": "Status Controller"
+ "name": "EI Service status",
+ "description": "API for monitoring of the service"
}
]
}
\ No newline at end of file
openapi: 3.0.1
info:
- title: Enrichment Data service
- description: This page lists all the rest apis for the service.
+ title: Enrichment Information Service
+ description: <h1>API documentation</h1><h2>General</h2><p> The service is mainly
+ a broker between data producers and data consumers. A data producer has the ability
+ to producer one or several type of data (EI type). One type of data can be produced
+ by zero to many producers. <br /><br />A data consumer can have several active
+ data subscriptions (EI job). One EI job consists of the the type of data to produce
+ and additional parameters for filtering of the data. These parameters are different
+ for different data types.</p><h2>APIs provided by the service</h2><h4>A1-EI</h4><p> This
+ API is between Near-RT RIC, which is a data consumer and the Non-RT RIC. </p><h4>Data
+ producer API</h4><p> This API is between data producers and this service. It
+ is divivided into two parts, where one is provided by this service (registration)
+ and one part is provided by the data producer.</p><h4>EI Service status</h4><p> This
+ API provides a means to monitor the service.</p>
+ license:
+ name: Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.
+ url: http://www.apache.org/licenses/LICENSE-2.0
version: "1.0"
servers:
- url: /
tags:
-- name: A1-EI (enrichment information)
- description: Consumer Controller
-- name: A1-EI (enrichment information) callbacks
- description: Consumer Simulator Controller
-- name: Data Producer Job Control (example producer)
- description: Producer Simulator Controller
-- name: Data Producer Registry API
- description: Producer Controller
-- name: Service status
- description: Status Controller
+- name: A1-EI (registration)
+ description: Data consumer EI job registration
+- name: A1-EI (callbacks)
+ description: Data consumer EI job status callbacks
+- name: Data producer (callbacks)
+ description: API implemented by data producers
+- name: Data producer (registration)
+ description: API for data producers
+- name: EI Service status
+ description: API for monitoring of the service
paths:
/producer_simulator/ei_job:
post:
tags:
- - Data Producer Job Control (example producer)
- summary: Callback for EI job creation
- operationId: jobCreatedCallbackUsingPOST
+ - Data producer (callbacks)
+ summary: Callback for EI job creation/modification
+ description: The call is invoked to activate or to modify a data subscription.
+ The endpoint is provided by the EI producer.
+ operationId: jobCreatedCallback
requestBody:
- description: request
content:
application/json:
schema:
responses:
200:
description: OK
- content: {}
- 201:
- description: Created
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
/A1-EI/v1/eitypes/{eiTypeId}:
get:
tags:
- - A1-EI (enrichment information)
+ - A1-EI (registration)
summary: Individual EI type
- operationId: getEiTypeUsingGET
+ operationId: getEiType_1
parameters:
- name: eiTypeId
in: path
- description: eiTypeId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
application/json:
schema:
$ref: '#/components/schemas/EiTypeObject'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Enrichment Information type is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
- /consumer_simulator/eijobs/{eiJobId}/status:
- post:
- tags:
- - A1-EI (enrichment information) callbacks
- summary: Callback for EI job status
- operationId: jobStatusCallbackUsingPOST
- parameters:
- - name: eiJobId
- in: path
- description: eiJobId
- required: true
- schema:
- type: string
- requestBody:
- description: status
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/EiJobStatusObject'
- required: true
- responses:
- 200:
- description: OK
- content: {}
- 201:
- description: Created
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
/ei-producer/v1/eitypes:
get:
tags:
- - Data Producer Registry API
+ - Data producer (registration)
summary: EI type identifiers
- operationId: getEiTypeIdentifiersUsingGET_1
+ operationId: getEiTypeIdentifiers
responses:
200:
description: EI type identifiers
type: array
items:
type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
/A1-EI/v1/eitypes:
get:
tags:
- - A1-EI (enrichment information)
+ - A1-EI (registration)
summary: EI type identifiers
- operationId: getEiTypeIdentifiersUsingGET
+ operationId: getEiTypeIdentifiers_1
responses:
200:
description: EI type identifiers
type: array
items:
type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
/ei-producer/v1/eiproducers/{eiProducerId}/status:
get:
tags:
- - Data Producer Registry API
+ - Data producer (registration)
summary: EI producer status
- operationId: getEiProducerStatusUsingGET
+ operationId: getEiProducerStatus
parameters:
- name: eiProducerId
in: path
- description: eiProducerId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
application/json:
schema:
$ref: '#/components/schemas/producer_status'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Enrichment Information producer is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
/producer_simulator/ei_job/{eiJobId}:
delete:
tags:
- - Data Producer Job Control (example producer)
+ - Data producer (callbacks)
summary: Callback for EI job deletion
- operationId: jobDeletedCallbackUsingDELETE
+ description: The call is invoked to terminate a data subscription. The endpoint
+ is provided by the EI producer.
+ operationId: jobDeletedCallback
parameters:
- name: eiJobId
in: path
- description: eiJobId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
200:
description: OK
- content: {}
- 204:
- description: No Content
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- deprecated: false
- /ei-producer/v1/eiproducers:
- get:
- tags:
- - Data Producer Registry API
- summary: EI producer identifiers
- operationId: getEiProducerIdentifiersUsingGET
- parameters:
- - name: ei_type_id
- in: query
- description: If given, only the producers for the EI Data type is returned.
- allowEmptyValue: false
- schema:
- type: string
- responses:
- 200:
- description: EI producer identifiers
content:
application/json:
schema:
- type: array
- items:
- type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
+ $ref: '#/components/schemas/Void'
/ei-producer/v1/eitypes/{eiTypeId}:
get:
tags:
- - Data Producer Registry API
+ - Data producer (registration)
summary: Individual EI type
- operationId: getEiTypeUsingGET_1
+ operationId: getEiType
parameters:
- name: eiTypeId
in: path
- description: eiTypeId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
application/json:
schema:
$ref: '#/components/schemas/producer_ei_type_info'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Enrichment Information type is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
put:
tags:
- - Data Producer Registry API
+ - Data producer (registration)
summary: Individual EI type
- operationId: putEiTypeUsingPUT
+ operationId: putEiType
parameters:
- name: eiTypeId
in: path
- description: eiTypeId
required: true
+ style: simple
+ explode: false
schema:
type: string
requestBody:
- description: registrationInfo
content:
application/json:
schema:
responses:
200:
description: Type updated
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
201:
description: Type created
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
400:
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
delete:
tags:
- - Data Producer Registry API
+ - Data producer (registration)
summary: Individual EI type
- operationId: deleteEiTypeUsingDELETE
+ operationId: deleteEiType
parameters:
- name: eiTypeId
in: path
- description: eiTypeId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
200:
description: Not used
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
204:
description: Producer deleted
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
404:
description: Enrichment Information type is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
/status:
get:
tags:
- - Service status
+ - EI Service status
summary: Returns status and statistics of this service
- operationId: getStatusUsingGET
+ operationId: getStatus
responses:
200:
description: Service is living
application/json:
schema:
$ref: '#/components/schemas/status_info'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
+ /ei-producer/v1/eiproducers:
+ get:
+ tags:
+ - Data producer (registration)
+ summary: EI producer identifiers
+ operationId: getEiProducerIdentifiers
+ parameters:
+ - name: ei_type_id
+ in: query
+ description: If given, only the producers for the EI Data type is returned.
+ required: false
+ style: form
+ explode: true
+ schema:
+ type: string
+ responses:
+ 200:
+ description: EI producer identifiers
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
/A1-EI/v1/eijobs/{eiJobId}:
get:
tags:
- - A1-EI (enrichment information)
+ - A1-EI (registration)
summary: Individual EI job
- operationId: getIndividualEiJobUsingGET
+ operationId: getIndividualEiJob
parameters:
- name: eiJobId
in: path
- description: eiJobId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
application/json:
schema:
$ref: '#/components/schemas/EiJobObject'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Enrichment Information job is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
put:
tags:
- - A1-EI (enrichment information)
+ - A1-EI (registration)
summary: Individual EI job
- operationId: putIndividualEiJobUsingPUT
+ operationId: putIndividualEiJob
parameters:
- name: eiJobId
in: path
- description: eiJobId
required: true
+ style: simple
+ explode: false
schema:
type: string
requestBody:
- description: eiJobObject
content:
application/json:
schema:
responses:
200:
description: Job updated
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
201:
description: Job created
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
404:
description: Enrichment Information type is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
delete:
tags:
- - A1-EI (enrichment information)
+ - A1-EI (registration)
summary: Individual EI job
- operationId: deleteIndividualEiJobUsingDELETE
+ operationId: deleteIndividualEiJob
parameters:
- name: eiJobId
in: path
- description: eiJobId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
200:
description: Not used
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
204:
description: Job deleted
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
404:
description: Enrichment Information job is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
/ei-producer/v1/eiproducers/{eiProducerId}:
get:
tags:
- - Data Producer Registry API
+ - Data producer (registration)
summary: Individual EI producer
- operationId: getEiProducerUsingGET
+ operationId: getEiProducer
parameters:
- name: eiProducerId
in: path
- description: eiProducerId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
application/json:
schema:
$ref: '#/components/schemas/producer_registration_info'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Enrichment Information producer is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
put:
tags:
- - Data Producer Registry API
+ - Data producer (registration)
summary: Individual EI producer
- operationId: putEiProducerUsingPUT
+ operationId: putEiProducer
parameters:
- name: eiProducerId
in: path
- description: eiProducerId
required: true
+ style: simple
+ explode: false
schema:
type: string
requestBody:
- description: registrationInfo
content:
application/json:
schema:
responses:
200:
description: Producer updated
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
201:
description: Producer created
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
delete:
tags:
- - Data Producer Registry API
+ - Data producer (registration)
summary: Individual EI producer
- operationId: deleteEiProducerUsingDELETE
+ operationId: deleteEiProducer
parameters:
- name: eiProducerId
in: path
- description: eiProducerId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
200:
description: Not used
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
204:
description: Producer deleted
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
404:
description: Producer is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
/producer_simulator/health_check:
get:
tags:
- - Data Producer Job Control (example producer)
+ - Data producer (callbacks)
summary: Producer supervision
- operationId: producerSupervisionUsingGET
+ description: The endpoint is provided by the EI producer and is used for supervision
+ of the producer.
+ operationId: producerSupervision
responses:
200:
- description: OK
+ description: The producer is OK
content:
application/json:
schema:
type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
/ei-producer/v1/eiproducers/{eiProducerId}/eijobs:
get:
tags:
- - Data Producer Registry API
+ - Data producer (registration)
summary: EI job definitions
description: EI job definitions for one EI producer
- operationId: getEiProducerJobsUsingGET
+ operationId: getEiProducerJobs
parameters:
- name: eiProducerId
in: path
- description: eiProducerId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
type: array
items:
$ref: '#/components/schemas/producer_ei_job_request'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Enrichment Information producer is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
/A1-EI/v1/eijobs:
get:
tags:
- - A1-EI (enrichment information)
+ - A1-EI (registration)
summary: EI job identifiers
description: query for EI job identifiers
- operationId: getEiJobIdsUsingGET
+ operationId: getEiJobIds
parameters:
- name: eiTypeId
in: query
description: selects EI jobs of matching EI type
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
- name: owner
in: query
description: selects EI jobs for one EI job owner
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
type: array
items:
type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Enrichment Information type is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
/A1-EI/v1/eijobs/{eiJobId}/status:
get:
tags:
- - A1-EI (enrichment information)
+ - A1-EI (registration)
summary: EI job status
- operationId: getEiJobStatusUsingGET
+ operationId: getEiJobStatus
parameters:
- name: eiJobId
in: path
- description: eiJobId
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
application/json:
schema:
$ref: '#/components/schemas/EiJobStatusObject'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Enrichment Information job is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- deprecated: false
+ /example_dataconsumer/eijobs/{eiJobId}/status:
+ post:
+ tags:
+ - A1-EI (callbacks)
+ summary: Callback for changed EI job status
+ description: The primitive is implemented by the data consumer and is invoked
+ when a EI job status has been changed.
+ operationId: jobStatusCallback
+ parameters:
+ - name: eiJobId
+ in: path
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/EiJobStatusObject'
+ required: true
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
components:
schemas:
producer_ei_job_request:
- title: producer_ei_job_request
required:
- ei_job_identity
type: object
description: The time when the job was last updated or created (ISO-8601)
ei_job_data:
type: object
- properties: {}
description: Json for the job data
target_uri:
type: string
description: Type idenitity for the job
description: The body of the EI producer callbacks for EI job creation and deletion
EiTypeObject:
- title: EiTypeObject
type: object
description: Information for an EI type
status_info:
- title: status_info
+ required:
+ - no_of_jobs
+ - no_of_producers
+ - no_of_types
+ - status
type: object
properties:
no_of_producers:
type: integer
description: Number of EI producers
format: int32
- no_of_jobs:
- type: integer
- description: Number of EI jobs
- format: int32
no_of_types:
type: integer
description: Number of EI types
format: int32
+ no_of_jobs:
+ type: integer
+ description: Number of EI jobs
+ format: int32
status:
type: string
description: status text
producer_ei_type_info:
- title: producer_ei_type_info
required:
- ei_job_data_schema
type: object
properties:
ei_job_data_schema:
type: object
- properties: {}
description: Json schema for the job data
description: Information for an EI type
producer_registration_info:
- title: producer_registration_info
required:
- ei_job_callback_url
- ei_producer_supervision_callback_url
description: Supported EI type IDs
items:
type: string
+ description: Supported EI type IDs
ei_producer_supervision_callback_url:
type: string
description: callback for producer supervision
description: callback for EI job
description: Information for an EI producer
producer_status:
- title: producer_status
required:
- operational_state
type: object
properties:
operational_state:
type: string
- description: |-
- Operational state, values:
- ENABLED: TBD
- DISABLED: TBD.
+ description: Represents the operational states
enum:
- ENABLED
- DISABLED
description: Status for an EI Producer
ProblemDetails:
- title: ProblemDetails
type: object
properties:
detail:
example: 404
description: A problem detail to carry details in a HTTP response according
to RFC 7807
+ Void:
+ type: object
+ description: 'Void/empty '
EiJobStatusObject:
- title: EiJobStatusObject
required:
- eiJobStatus
type: object
properties:
eiJobStatus:
type: string
- description: |-
- values:
- ENABLED: the A1-EI producer is able to deliver EI result for the EI job
- DISABLED: the A1-EI producer is unable to deliver EI result for the EI job
+ description: Allowed values for EI job status
enum:
- ENABLED
- DISABLED
description: Status for an EI job
EiJobObject:
- title: EiJobObject
required:
- eiTypeId
- jobDefinition
jobOwner:
type: string
description: Identity of the owner of the job
- jobStatusNotificationUri:
+ statusNotificationUri:
type: string
description: The target of EI job status notifications
jobDefinition:
type: object
- properties: {}
description: EI type specific job data
description: Information for an Enrichment Information Job
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>2.3.4.RELEASE</version>
+ <version>2.4.2</version>
<relativePath />
</parent>
<groupId>org.o-ran-sc.nonrtric</groupId>
</repositories>
<properties>
<java.version>11</java.version>
- <springfox.version>2.9.2</springfox.version>
+ <springfox.version>3.0.0</springfox.version>
<immutable.version>2.8.2</immutable.version>
<sdk.version>1.1.6</sdk.version>
- <swagger.version>2.0.0</swagger.version>
+ <swagger.version>2.1.6</swagger.version>
<json.version>20190722</json.version>
<commons-net.version>3.6</commons-net.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<exec.skip>true</exec.skip>
</properties>
<dependencies>
+ <dependency>
+ <groupId>org.springdoc</groupId>
+ <artifactId>springdoc-openapi-ui</artifactId>
+ <version>1.5.2</version>
+ </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<system>JIRA</system>
<url>https://jira.o-ran-sc.org/</url>
</issueManagement>
-</project>
+</project>
\ No newline at end of file
package org.oransc.enrichment;
-import com.fasterxml.classmate.TypeResolver;
-import com.google.common.base.Predicates;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.info.License;
+import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
-
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import org.oransc.enrichment.controllers.StatusController;
+import org.oransc.enrichment.controllers.consumer.ConsumerConsts;
+import org.oransc.enrichment.controllers.producer.ProducerConsts;
/**
- * Swagger configuration class that uses swagger2 documentation type and scans
+ * Swagger configuration class that uses swagger documentation type and scans
* all the controllers. To access the swagger gui go to
* http://ip:port/swagger-ui.html
*/
-@Configuration
-@EnableSwagger2
-public class SwaggerConfig extends WebMvcConfigurationSupport {
-
- static final String API_TITLE = "Enrichment Data service";
- static final String DESCRIPTION = "This page lists all the rest apis for the service.";
- static final String VERSION = "1.0";
- @SuppressWarnings("squid:S1075") // Refactor your code to get this URI from a customizable parameter.
- static final String RESOURCES_PATH = "classpath:/META-INF/resources/";
- static final String WEBJARS_PATH = RESOURCES_PATH + "webjars/";
- static final String SWAGGER_UI = "swagger-ui.html";
- static final String WEBJARS = "/webjars/**";
- /**
- * Gets the API info.
- *
- * @return the API info.
- */
- @Bean
- public Docket api(TypeResolver resolver) {
- return new Docket(DocumentationType.SWAGGER_2) //
- .apiInfo(apiInfo()) //
- .select() //
- .apis(RequestHandlerSelectors.any()) //
- .paths(PathSelectors.any()) //
- .paths(Predicates.not(PathSelectors.regex("/error"))) // this endpoint is not implemented, but was
- // visible for Swagger
- .paths(Predicates.not(PathSelectors.regex("/actuator.*"))) // this endpoint is implemented by spring
- // framework, exclude for now
- .build();
+@OpenAPIDefinition( //
+ tags = {@Tag(name = ConsumerConsts.CONSUMER_API_NAME, description = ConsumerConsts.CONSUMER_API_DESCRIPTION),
+ @Tag(
+ name = ConsumerConsts.CONSUMER_API_CALLBACKS_NAME,
+ description = ConsumerConsts.CONSUMER_API_CALLBACKS_DESCRIPTION),
+ @Tag(
+ name = ProducerConsts.PRODUCER_API_CALLBACKS_NAME,
+ description = ProducerConsts.PRODUCER_API_CALLBACKS_DESCRIPTION),
+ @Tag(name = ProducerConsts.PRODUCER_API_NAME, description = ProducerConsts.PRODUCER_API_DESCRIPTION), //
+ @Tag(name = StatusController.API_NAME, description = StatusController.API_DESCRIPTION)}, //
+ info = @Info(
+ title = "Enrichment Information Service", //
+ version = "1.0", //
+ description = SwaggerConfig.DESCRIPTION, //
+ license = @License(
+ name = "Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.",
+ url = "http://www.apache.org/licenses/LICENSE-2.0")))
+public class SwaggerConfig {
+ private SwaggerConfig() {
}
- private static ApiInfo apiInfo() {
- return new ApiInfoBuilder() //
- .title(API_TITLE) //
- .description(DESCRIPTION) //
- .version(VERSION) //
- .build();
- }
-
- @Override
- protected void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler(SWAGGER_UI) //
- .addResourceLocations(RESOURCES_PATH);
+ static final String API_TITLE = "Enrichment Data service";
- registry.addResourceHandler(WEBJARS) //
- .addResourceLocations(WEBJARS_PATH);
- }
+ static final String DESCRIPTION = "<h1>API documentation</h1>" + "<h2>General</h2>" + "<p>"
+ + " The service is mainly a broker between data producers and data consumers. A data producer has the ability to producer one or several type of data (EI type). One type of data can be produced by zero to many producers. <br /><br />A data consumer can have several active data subscriptions (EI job). One EI job consists of the the type of data to produce and additional parameters for filtering of the data. These parameters are different for different data types."
+ + "</p>" + "<h2>APIs provided by the service</h2>" + "<h4>A1-EI</h4>" + "<p>"
+ + " This API is between Near-RT RIC, which is a data consumer and the Non-RT RIC. " + "</p>"
+ + "<h4>Data producer API</h4>" + "<p>"
+ + " This API is between data producers and this service. It is divivided into two parts, where one is provided by this service (registration) and one part is provided by the data producer."
+ + "</p>" + "<h4>EI Service status</h4>" + "<p>" + " This API provides a means to monitor the service."
+ + "</p>";
}
import reactor.core.publisher.Mono;
import reactor.netty.http.client.HttpClient;
-import reactor.netty.resources.ConnectionProvider;
-import reactor.netty.tcp.ProxyProvider.Proxy;
-import reactor.netty.tcp.TcpClient;
+import reactor.netty.transport.ProxyProvider;
/**
* Generic reactive REST client.
&& !httpProxyConfig.httpProxyHost().isEmpty();
}
- private TcpClient createTcpClient() {
- TcpClient client = TcpClient.create(ConnectionProvider.newConnection()) //
+ private HttpClient buildHttpClient() {
+ HttpClient httpClient = HttpClient.create() //
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000) //
.doOnConnected(connection -> {
connection.addHandlerLast(new ReadTimeoutHandler(30));
connection.addHandlerLast(new WriteTimeoutHandler(30));
});
+
if (this.sslContext != null) {
- client = client.secure(c -> c.sslContext(sslContext));
+ httpClient = httpClient.secure(ssl -> {
+ ssl.sslContext(sslContext);
+ });
}
+
if (isHttpProxyConfigured()) {
- client = client.proxy(proxy -> proxy.type(Proxy.HTTP).host(httpProxyConfig.httpProxyHost())
- .port(httpProxyConfig.httpProxyPort()));
+ httpClient = httpClient.proxy(proxy -> proxy.type(ProxyProvider.Proxy.HTTP)
+ .host(httpProxyConfig.httpProxyHost()).port(httpProxyConfig.httpProxyPort()));
}
- return client;
+ return httpClient;
}
- private WebClient createWebClient(String baseUrl, TcpClient tcpClient) {
- HttpClient httpClient = HttpClient.from(tcpClient);
-
- ReactorClientHttpConnector connector = new ReactorClientHttpConnector(httpClient);
+ private WebClient buildWebClient(String baseUrl) {
+ final HttpClient httpClient = buildHttpClient();
ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder() //
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(-1)) //
.build();
return WebClient.builder() //
- .clientConnector(connector) //
+ .clientConnector(new ReactorClientHttpConnector(httpClient)) //
.baseUrl(baseUrl) //
.exchangeStrategies(exchangeStrategies) //
.build();
private Mono<WebClient> getWebClient() {
if (this.webClient == null) {
- try {
- TcpClient tcpClient = createTcpClient();
- this.webClient = createWebClient(this.baseUrl, tcpClient);
- } catch (Exception e) {
- logger.error("Could not create WebClient {}", e.getMessage());
- return Mono.error(e);
- }
+ this.webClient = buildWebClient(baseUrl);
}
- return Mono.just(this.webClient);
+ return Mono.just(buildWebClient(baseUrl));
}
}
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.oransc.enrichment.exceptions.ServiceException;
import org.springframework.http.HttpHeaders;
private static Gson gson = new GsonBuilder().create();
// Returned as body for all failed REST calls
- @ApiModel(
- value = "ProblemDetails",
+ @Schema(
+ name = "ProblemDetails",
description = "A problem detail to carry details in a HTTP response according to RFC 7807")
public static class ErrorInfo {
@SerializedName("type")
this.status = status;
}
- @ApiModelProperty(
+ @Schema(
example = "404",
- value = "The HTTP status code generated by the origin server for this occurrence of the problem.")
+ description = "The HTTP status code generated by the origin server for this occurrence of the problem.")
public Integer getStatus() {
return status;
}
- @ApiModelProperty(
+ @Schema(
example = "EI job type not found",
- value = "A human-readable explanation specific to this occurrence of the problem.")
+ description = "A human-readable explanation specific to this occurrence of the problem.")
public String getDetail() {
return this.detail;
}
}
- @ApiModelProperty(value = "message")
+ @Schema(name = "message")
public final String message;
ErrorResponse(String message) {
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.immutables.gson.Gson;
import org.oransc.enrichment.repository.EiJobs;
import reactor.core.publisher.Mono;
@RestController("StatusController")
-@Api(tags = "Service status")
+@Tag(name = StatusController.API_NAME)
public class StatusController {
+ public static final String API_NAME = "EI Service status";
+ public static final String API_DESCRIPTION = "API for monitoring of the service";
+
@Autowired
private EiJobs eiJobs;
private EiProducers eiProducers;
@Gson.TypeAdapters
- @ApiModel(value = "status_info")
+ @Schema(name = "status_info")
public static class StatusInfo {
- @ApiModelProperty(value = "status text")
+ @Schema(name = "status", description = "status text")
@SerializedName("status")
@JsonProperty(value = "status", required = true)
public final String status;
- @ApiModelProperty(value = "Number of EI producers")
+ @Schema(name = "no_of_producers", description = "Number of EI producers")
@SerializedName("no_of_producers")
@JsonProperty(value = "no_of_producers", required = true)
public final int noOfProducers;
- @ApiModelProperty(value = "Number of EI types")
+ @Schema(name = "no_of_types", description = "Number of EI types")
@SerializedName("no_of_types")
@JsonProperty(value = "no_of_types", required = true)
public final int noOfTypes;
- @ApiModelProperty(value = "Number of EI jobs")
+ @Schema(name = "no_of_jobs", description = "Number of EI jobs")
@SerializedName("no_of_jobs")
@JsonProperty(value = "no_of_jobs", required = true)
public final int noOfJobs;
}
@GetMapping(path = "/status", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns status and statistics of this service")
+ @Operation(summary = "Returns status and statistics of this service")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "Service is living", response = StatusInfo.class) //
+ @ApiResponse(
+ responseCode = "200",
+ description = "Service is living", //
+ content = @Content(schema = @Schema(implementation = StatusInfo.class))) //
})
public Mono<ResponseEntity<Object>> getStatus() {
StatusInfo info = new StatusInfo("hunky dory", this.eiProducers, this.eiTypes, this.eiJobs);
package org.oransc.enrichment.controllers;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "Void", description = "Void/empty")
+@Schema(name = "Void", description = "Void/empty ")
public class VoidResponse {
private VoidResponse() {
}
public class ConsumerConsts {
+ public static final String CONSUMER_API_NAME = "A1-EI (registration)";
+ public static final String CONSUMER_API_DESCRIPTION = "Data consumer EI job registration";
+
+ public static final String CONSUMER_API_CALLBACKS_NAME = "A1-EI (callbacks)";
+ public static final String CONSUMER_API_CALLBACKS_DESCRIPTION = "Data consumer EI job status callbacks";
+
public static final String API_ROOT = "/A1-EI/v1";
- public static final String CONSUMER_API_NAME = "A1-EI (enrichment information)";
public static final String OWNER_PARAM = "owner";
public static final String OWNER_PARAM_DESCRIPTION = "selects EI jobs for one EI job owner";
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;
-import org.everit.json.schema.Schema;
-import org.everit.json.schema.loader.SchemaLoader;
import org.json.JSONObject;
import org.oransc.enrichment.configuration.ApplicationConfig;
import org.oransc.enrichment.controllers.ErrorResponse;
import reactor.core.publisher.Mono;
@SuppressWarnings("java:S3457") // No need to call "toString()" method as formatting and string ..
-@RestController("ConsumerController")
-@Api(tags = {ConsumerConsts.CONSUMER_API_NAME})
+@RestController("A1-EI")
+@Tag(name = ConsumerConsts.CONSUMER_API_NAME)
@RequestMapping(path = ConsumerConsts.API_ROOT, produces = MediaType.APPLICATION_JSON_VALUE)
public class ConsumerController {
private static Gson gson = new GsonBuilder().create();
@GetMapping(path = "/eitypes", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "EI type identifiers", notes = "")
+ @Operation(summary = "EI type identifiers", description = "")
@ApiResponses(
value = { //
@ApiResponse(
- code = 200,
- message = "EI type identifiers",
- response = String.class,
- responseContainer = "List"), //
+ responseCode = "200",
+ description = "EI type identifiers", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))), //
})
public ResponseEntity<Object> getEiTypeIdentifiers( //
) {
}
@GetMapping(path = "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Individual EI type", notes = "")
+ @Operation(summary = "Individual EI type", description = "")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "EI type", response = ConsumerEiTypeInfo.class), //
@ApiResponse(
- code = 404,
- message = "Enrichment Information type is not found",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "200",
+ description = "EI type", //
+ content = @Content(schema = @Schema(implementation = ConsumerEiTypeInfo.class))), //
+ @ApiResponse(
+ responseCode = "404",
+ description = "Enrichment Information type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getEiType( //
@PathVariable("eiTypeId") String eiTypeId) {
try {
}
@GetMapping(path = "/eijobs", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "EI job identifiers", notes = "query for EI job identifiers")
+ @Operation(summary = "EI job identifiers", description = "query for EI job identifiers")
@ApiResponses(
value = { //
@ApiResponse(
- code = 200,
- message = "EI job identifiers",
- response = String.class,
- responseContainer = "List"), //
+ responseCode = "200",
+ description = "EI job identifiers", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))),
@ApiResponse(
- code = 404,
- message = "Enrichment Information type is not found",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "404",
+ description = "Enrichment Information type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getEiJobIds( //
- @ApiParam(
+ @Parameter(
name = ConsumerConsts.EI_TYPE_ID_PARAM,
required = false, //
- value = ConsumerConsts.EI_TYPE_ID_PARAM_DESCRIPTION) //
+ description = ConsumerConsts.EI_TYPE_ID_PARAM_DESCRIPTION) //
@RequestParam(name = ConsumerConsts.EI_TYPE_ID_PARAM, required = false) String eiTypeId,
- @ApiParam(
+ @Parameter(
name = ConsumerConsts.OWNER_PARAM,
required = false, //
- value = ConsumerConsts.OWNER_PARAM_DESCRIPTION) //
+ description = ConsumerConsts.OWNER_PARAM_DESCRIPTION) //
@RequestParam(name = ConsumerConsts.OWNER_PARAM, required = false) String owner) {
try {
List<String> result = new ArrayList<>();
}
}
- @GetMapping(path = "/eijobs/{eiJobId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Individual EI job", notes = "")
+ @GetMapping(path = "/eijobs/{eiJobId}", produces = MediaType.APPLICATION_JSON_VALUE) //
+ @Operation(summary = "Individual EI job", description = "") //
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "EI job", response = ConsumerEiJobInfo.class), //
@ApiResponse(
- code = 404,
- message = "Enrichment Information job is not found",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "200",
+ description = "EI job", //
+ content = @Content(schema = @Schema(implementation = ConsumerEiJobInfo.class))), //
+ @ApiResponse(
+ responseCode = "404",
+ description = "Enrichment Information job is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getIndividualEiJob( //
@PathVariable("eiJobId") String eiJobId) {
try {
}
@GetMapping(path = "/eijobs/{eiJobId}/status", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "EI job status", notes = "")
+ @Operation(summary = "EI job status", description = "")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "EI job status", response = ConsumerEiJobStatus.class), //
@ApiResponse(
- code = 404,
- message = "Enrichment Information job is not found",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "200",
+ description = "EI job status", //
+ content = @Content(schema = @Schema(implementation = ConsumerEiJobStatus.class))), //
+ @ApiResponse(
+ responseCode = "404",
+ description = "Enrichment Information job is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getEiJobStatus( //
@PathVariable("eiJobId") String eiJobId) {
try {
}
@DeleteMapping(path = "/eijobs/{eiJobId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Individual EI job", notes = "")
+ @Operation(summary = "Individual EI job", description = "")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 204, message = "Job deleted", response = VoidResponse.class),
@ApiResponse(
- code = 404,
- message = "Enrichment Information job is not found",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "200",
+ description = "Not used", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(
+ responseCode = "204",
+ description = "Job deleted", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(
+ responseCode = "404",
+ description = "Enrichment Information job is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> deleteIndividualEiJob( //
@PathVariable("eiJobId") String eiJobId) {
try {
path = "/eijobs/{eiJobId}", //
produces = MediaType.APPLICATION_JSON_VALUE, //
consumes = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Individual EI job", notes = "")
+ @Operation(summary = "Individual EI job", description = "")
@ApiResponses(
value = { //
- @ApiResponse(code = 201, message = "Job created", response = VoidResponse.class), //
- @ApiResponse(code = 200, message = "Job updated", response = VoidResponse.class), // ,
@ApiResponse(
- code = 404,
- message = "Enrichment Information type is not found",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "201",
+ description = "Job created", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(
+ responseCode = "200",
+ description = "Job updated", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(
+ responseCode = "404",
+ description = "Enrichment Information type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public Mono<ResponseEntity<Object>> putIndividualEiJob( //
@PathVariable("eiJobId") String eiJobId, //
@RequestBody ConsumerEiJobInfo eiJobObject) {
private Mono<EiJob> validatePutEiJob(String eiJobId, ConsumerEiJobInfo eiJobInfo) {
try {
EiType eiType = this.eiTypes.getType(eiJobInfo.eiTypeId);
- validateJsonObjectAgainstSchema(eiType.getJobDataSchema(), eiJobInfo.jobData);
+ validateJsonObjectAgainstSchema(eiType.getJobDataSchema(), eiJobInfo.jobDefinition);
EiJob existingEiJob = this.eiJobs.get(eiJobId);
if (existingEiJob != null && !existingEiJob.getTypeId().equals(eiJobInfo.eiTypeId)) {
String schemaAsString = mapper.writeValueAsString(schemaObj);
JSONObject schemaJSON = new JSONObject(schemaAsString);
- Schema schema = SchemaLoader.load(schemaJSON);
+ org.everit.json.schema.Schema schema = org.everit.json.schema.loader.SchemaLoader.load(schemaJSON);
String objectAsString = mapper.writeValueAsString(object);
JSONObject json = new JSONObject(objectAsString);
.id(id) //
.typeId(type.getId()) //
.owner(info.owner) //
- .jobData(info.jobData) //
- .targetUrl(info.targetUri) //
+ .jobData(info.jobDefinition) //
+ .targetUrl(info.jobResultUri) //
.jobStatusUrl(info.statusNotificationUri == null ? "" : info.statusNotificationUri) //
.build();
}
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "EiJobObject", description = "Information for an Enrichment Information Job")
+@Schema(name = "EiJobObject", description = "Information for an Enrichment Information Job")
public class ConsumerEiJobInfo {
- @ApiModelProperty(value = "EI type Idenitifier of the EI job", required = true)
+ @Schema(name = "eiTypeId", description = "EI type Idenitifier of the EI job", required = true)
@SerializedName("eiTypeId")
@JsonProperty(value = "eiTypeId", required = true)
public String eiTypeId;
- @ApiModelProperty(value = "Identity of the owner of the job", required = true)
+ @Schema(name = "jobOwner", description = "Identity of the owner of the job", required = true)
@SerializedName("jobOwner")
@JsonProperty(value = "jobOwner", required = true)
public String owner;
- @ApiModelProperty(value = "EI type specific job data", required = true)
+ @Schema(name = "jobDefinition", description = "EI type specific job data", required = true)
@SerializedName("jobDefinition")
@JsonProperty(value = "jobDefinition", required = true)
- public Object jobData;
+ public Object jobDefinition;
- @ApiModelProperty(value = "The target URI of the EI data", required = true)
+ @Schema(name = "jobResultUri", description = "The target URI of the EI data", required = true)
@SerializedName("jobResultUri")
@JsonProperty(value = "jobResultUri", required = true)
- public String targetUri;
+ public String jobResultUri;
- @ApiModelProperty(value = "The target of EI job status notifications", required = false)
+ @Schema(name = "statusNotificationUri", description = "The target of EI job status notifications", required = false)
@SerializedName("jobStatusNotificationUri")
@JsonProperty(value = "jobStatusNotificationUri", required = false)
public String statusNotificationUri;
public ConsumerEiJobInfo(String eiTypeId, Object jobData, String owner, String targetUri,
String statusNotificationUri) {
this.eiTypeId = eiTypeId;
- this.jobData = jobData;
+ this.jobDefinition = jobData;
this.owner = owner;
- this.targetUri = targetUri;
+ this.jobResultUri = targetUri;
this.statusNotificationUri = statusNotificationUri;
}
}
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "EiJobStatusObject", description = "Status for an EI job")
+@Schema(name = "EiJobStatusObject", description = "Status for an EI job")
public class ConsumerEiJobStatus {
@Gson.TypeAdapters
- @ApiModel(value = "EiJobStatusValues", description = "Allowed values for EI job status")
+ @Schema(name = "EiJobStatusValues", description = "Allowed values for EI job status")
public enum EiJobStatusValues {
ENABLED, DISABLED
}
+ "ENABLED: the A1-EI producer is able to deliver EI result for the EI job\n" //
+ "DISABLED: the A1-EI producer is unable to deliver EI result for the EI job";
- @ApiModelProperty(value = OPERATIONAL_STATE_DESCRIPTION, name = "eiJobStatus", required = true)
+ @Schema(name = "eiJobStatus", description = OPERATIONAL_STATE_DESCRIPTION, required = true)
@SerializedName("eiJobStatus")
@JsonProperty(value = "eiJobStatus", required = true)
public EiJobStatusValues state;
package org.oransc.enrichment.controllers.consumer;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "EiTypeObject", description = "Information for an EI type")
+@Schema(name = "EiTypeObject", description = "Information for an EI type")
public class ConsumerEiTypeInfo {
}
public class ProducerConsts {
public static final String API_ROOT = "/ei-producer/v1";
- public static final String PRODUCER_API_NAME = "Data Producer Registry API";
+ public static final String PRODUCER_API_NAME = "Data producer (registration)";
+ public static final String PRODUCER_API_DESCRIPTION = "API for data producers";
+
+ public static final String PRODUCER_API_CALLBACKS_NAME = "Data producer (callbacks)";
+ public static final String PRODUCER_API_CALLBACKS_DESCRIPTION = "API implemented by data producers";
private ProducerConsts() {
}
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.ArrayList;
import java.util.Collection;
import org.springframework.web.bind.annotation.RestController;
@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
-@RestController("ProducerController")
-@Api(tags = {ProducerConsts.PRODUCER_API_NAME})
+@RestController("Producer registry")
+@Tag(name = ProducerConsts.PRODUCER_API_NAME)
public class ProducerController {
private static Gson gson = new GsonBuilder().create();
@Autowired
private EiProducers eiProducers;
- @GetMapping(path = ProducerConsts.API_ROOT + "/eitypes", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "EI type identifiers", notes = "")
+ @GetMapping(path = ProducerConsts.API_ROOT + "/eitypes", produces = MediaType.APPLICATION_JSON_VALUE) //
+ @Operation(summary = "EI type identifiers", description = "") //
@ApiResponses(
value = { //
@ApiResponse(
- code = 200,
- message = "EI type identifiers",
- response = String.class,
- responseContainer = "List"), //
+ responseCode = "200",
+ description = "EI type identifiers", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))) //
})
public ResponseEntity<Object> getEiTypeIdentifiers( //
) {
}
@GetMapping(path = ProducerConsts.API_ROOT + "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Individual EI type", notes = "")
+ @Operation(summary = "Individual EI type", description = "")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "EI type", response = ProducerEiTypeInfo.class), //
@ApiResponse(
- code = 404,
- message = "Enrichment Information type is not found",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "200",
+ description = "EI type", //
+ content = @Content(schema = @Schema(implementation = ProducerEiTypeInfo.class))), //
+ @ApiResponse(
+ responseCode = "404",
+ description = "Enrichment Information type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))})
public ResponseEntity<Object> getEiType( //
@PathVariable("eiTypeId") String eiTypeId) {
try {
@PutMapping(path = ProducerConsts.API_ROOT + "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "Type updated", response = VoidResponse.class), //
- @ApiResponse(code = 201, message = "Type created", response = VoidResponse.class), //
- @ApiResponse(code = 400, message = "Bad request", response = ErrorResponse.ErrorInfo.class)})
-
- @ApiOperation(value = "Individual EI type", notes = "")
+ @ApiResponse(
+ responseCode = "200",
+ description = "Type updated", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(
+ responseCode = "201",
+ description = "Type created", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(
+ responseCode = "400",
+ description = "Bad request", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))})
+ @Operation(summary = "Individual EI type", description = "")
public ResponseEntity<Object> putEiType( //
- @PathVariable("eiTypeId") String eiTypeId, @RequestBody ProducerEiTypeInfo registrationInfo) {
+ @PathVariable("eiTypeId") String eiTypeId, //
+ @RequestBody ProducerEiTypeInfo registrationInfo) {
EiType previousDefinition = this.eiTypes.get(eiTypeId);
if (registrationInfo.jobDataSchema == null) {
return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK);
}
- @DeleteMapping(path = ProducerConsts.API_ROOT + "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Individual EI type", notes = "")
+ @DeleteMapping(path = ProducerConsts.API_ROOT + "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE) //
+ @Operation(summary = "Individual EI type", description = "") //
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 204, message = "Producer deleted", response = VoidResponse.class),
@ApiResponse(
- code = 404,
- message = "Enrichment Information type is not found",
- response = ErrorResponse.ErrorInfo.class),
+ responseCode = "200",
+ description = "Not used", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(
+ responseCode = "204",
+ description = "Producer deleted", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
@ApiResponse(
- code = 406,
- message = "The Enrichment Information type has one or several active producers",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "404",
+ description = "Enrichment Information type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
+ @ApiResponse(
+ responseCode = "406",
+ description = "The Enrichment Information type has one or several active producers", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> deleteEiType( //
@PathVariable("eiTypeId") String eiTypeId) {
}
@GetMapping(path = ProducerConsts.API_ROOT + "/eiproducers", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "EI producer identifiers", notes = "")
+ @Operation(summary = "EI producer identifiers", description = "")
@ApiResponses(
value = { //
@ApiResponse(
- code = 200,
- message = "EI producer identifiers",
- response = String.class,
- responseContainer = "List"), //
+ responseCode = "200",
+ description = "EI producer identifiers", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))) //
})
public ResponseEntity<Object> getEiProducerIdentifiers( //
- @ApiParam(
+ @Parameter(
name = "ei_type_id",
required = false,
- value = "If given, only the producers for the EI Data type is returned.") //
+ description = "If given, only the producers for the EI Data type is returned.") //
@RequestParam(name = "ei_type_id", required = false) String typeId //
) {
List<String> result = new ArrayList<>();
@GetMapping(
path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}",
produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Individual EI producer", notes = "")
+ @Operation(summary = "Individual EI producer", description = "")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "EI producer", response = ProducerRegistrationInfo.class), //
@ApiResponse(
- code = 404,
- message = "Enrichment Information producer is not found",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "200",
+ description = "EI producer", //
+ content = @Content(schema = @Schema(implementation = ProducerRegistrationInfo.class))), //
+ @ApiResponse(
+ responseCode = "404",
+ description = "Enrichment Information producer is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))//
+ })
public ResponseEntity<Object> getEiProducer( //
@PathVariable("eiProducerId") String eiProducerId) {
try {
@GetMapping(
path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}/eijobs",
produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "EI job definitions", notes = "EI job definitions for one EI producer")
+ @Operation(summary = "EI job definitions", description = "EI job definitions for one EI producer")
@ApiResponses(
value = { //
@ApiResponse(
- code = 200,
- message = "EI producer",
- response = ProducerJobInfo.class,
- responseContainer = "List"), //
+ responseCode = "404",
+ description = "Enrichment Information producer is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
@ApiResponse(
- code = 404,
- message = "Enrichment Information producer is not found",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "200",
+ description = "EI producer", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = ProducerJobInfo.class)))), //
+ })
public ResponseEntity<Object> getEiProducerJobs( //
@PathVariable("eiProducerId") String eiProducerId) {
try {
@GetMapping(
path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}/status",
- produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "EI producer status")
+ produces = MediaType.APPLICATION_JSON_VALUE) //
+ @Operation(summary = "EI producer status") //
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "EI producer status", response = ProducerStatusInfo.class), //
@ApiResponse(
- code = 404,
- message = "Enrichment Information producer is not found",
- response = ErrorResponse.ErrorInfo.class)})
+ responseCode = "200",
+ description = "EI producer status", //
+ content = @Content(schema = @Schema(implementation = ProducerStatusInfo.class))), //
+ @ApiResponse(
+ responseCode = "404",
+ description = "Enrichment Information producer is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getEiProducerStatus( //
@PathVariable("eiProducerId") String eiProducerId) {
try {
@PutMapping(
path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}", //
produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Individual EI producer", notes = "")
+ @Operation(summary = "Individual EI producer", description = "")
@ApiResponses(
value = { //
- @ApiResponse(code = 201, message = "Producer created", response = VoidResponse.class), //
- @ApiResponse(code = 200, message = "Producer updated", response = VoidResponse.class)} //
- )
+ @ApiResponse(
+ responseCode = "201",
+ description = "Producer created", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(
+ responseCode = "200",
+ description = "Producer updated", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))) //
+ })
public ResponseEntity<Object> putEiProducer( //
@PathVariable("eiProducerId") String eiProducerId, //
@RequestBody ProducerRegistrationInfo registrationInfo) {
@DeleteMapping(
path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}",
produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Individual EI producer", notes = "")
+ @Operation(summary = "Individual EI producer", description = "")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 204, message = "Producer deleted", response = VoidResponse.class),
- @ApiResponse(code = 404, message = "Producer is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(
+ responseCode = "200",
+ description = "Not used", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(
+ responseCode = "204",
+ description = "Producer deleted", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(
+ responseCode = "404",
+ description = "Producer is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> deleteEiProducer(@PathVariable("eiProducerId") String eiProducerId) {
try {
final EiProducer producer = this.eiProducers.getProducer(eiProducerId);
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "producer_ei_type_info", description = "Information for an EI type")
+@Schema(name = "producer_ei_type_info", description = "Information for an EI type")
public class ProducerEiTypeInfo {
- @ApiModelProperty(value = "Json schema for the job data", required = true)
+ @Schema(name = "ei_job_data_schema", description = "Json schema for the job data", required = true)
@SerializedName("ei_job_data_schema")
@JsonProperty(value = "ei_job_data_schema", required = true)
public Object jobDataSchema;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
import org.oransc.enrichment.repository.EiJob;
@Gson.TypeAdapters
-@ApiModel(
- value = "producer_ei_job_request",
+@Schema(
+ name = "producer_ei_job_request",
description = "The body of the EI producer callbacks for EI job creation and deletion")
public class ProducerJobInfo {
- @ApiModelProperty(value = "Idenitity of the EI job", required = true)
+ @Schema(name = "ei_job_identity", description = "Idenitity of the EI job", required = true)
@SerializedName("ei_job_identity")
@JsonProperty("ei_job_identity")
public String id;
- @ApiModelProperty(value = "Type idenitity for the job")
+ @Schema(name = "ei_type_identity", description = "Type idenitity for the job")
@SerializedName("ei_type_identity")
@JsonProperty("ei_type_identity")
public String typeId;
- @ApiModelProperty(value = "Json for the job data")
+ @Schema(name = "ei_job_data", description = "Json for the job data")
@SerializedName("ei_job_data")
@JsonProperty("ei_job_data")
public Object jobData;
- @ApiModelProperty(value = "URI for the target of the EI")
+ @Schema(name = "target_uri", description = "URI for the target of the EI")
@SerializedName("target_uri")
@JsonProperty("target_uri")
public String targetUri;
- @ApiModelProperty(value = "The owner of the job")
+ @Schema(name = "owner", description = "The owner of the job")
@SerializedName("owner")
@JsonProperty("owner")
public String owner;
- @ApiModelProperty(value = "The time when the job was last updated or created (ISO-8601)")
+ @Schema(name = "last_updated", description = "The time when the job was last updated or created (ISO-8601)")
@SerializedName("last_updated")
@JsonProperty("last_updated")
public String lastUpdated;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "producer_registration_info", description = "Information for an EI producer")
+@Schema(name = "producer_registration_info", description = "Information for an EI producer")
public class ProducerRegistrationInfo {
- @Gson.TypeAdapters
- @ApiModel(value = "producer_ei_type_registration_info", description = "Information for an EI type")
- public static class ProducerEiTypeRegistrationInfo {
-
- @ApiModelProperty(value = "EI type identity", required = true)
- @SerializedName("ei_type_identity")
- @JsonProperty(value = "ei_type_identity", required = true)
- public String eiTypeId;
-
- @ApiModelProperty(value = "Json schema for the job data")
- @SerializedName("ei_job_data_schema")
- @JsonProperty("ei_job_data_schema")
- public Object jobDataSchema;
-
- public ProducerEiTypeRegistrationInfo(Object jobDataSchema, String eiTypeId) {
- this.jobDataSchema = jobDataSchema;
- this.eiTypeId = eiTypeId;
- }
-
- public ProducerEiTypeRegistrationInfo() {
- }
- }
-
- @ApiModelProperty(value = "Supported EI type IDs", required = true)
+ @Schema(name = "supported_ei_types", description = "Supported EI type IDs", required = true)
@SerializedName("supported_ei_types")
@JsonProperty(value = "supported_ei_types", required = true)
public Collection<String> supportedTypeIds;
- @ApiModelProperty(value = "callback for EI job", required = true)
+ @Schema(name = "ei_job_callback_url", description = "callback for EI job", required = true)
@SerializedName("ei_job_callback_url")
@JsonProperty(value = "ei_job_callback_url", required = true)
public String jobCallbackUrl;
- @ApiModelProperty(value = "callback for producer supervision", required = true)
+ @Schema(
+ name = "ei_producer_supervision_callback_url",
+ description = "callback for producer supervision",
+ required = true)
@SerializedName("ei_producer_supervision_callback_url")
@JsonProperty(value = "ei_producer_supervision_callback_url", required = true)
public String producerSupervisionCallbackUrl;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "producer_status", description = "Status for an EI Producer")
+@Schema(name = "producer_status", description = "Status for an EI Producer")
public class ProducerStatusInfo {
@Gson.TypeAdapters
- @ApiModel(value = "producer_operational_state", description = "Represents the operational states")
+ @Schema(name = "producer_operational_state", description = "Represents the operational states")
public enum OperationalState {
ENABLED, DISABLED
}
+ "ENABLED: TBD\n" //
+ "DISABLED: TBD.";
- @ApiModelProperty(value = OPERATIONAL_STATE_DESCRIPTION, name = "operational_state", required = true)
+ @Schema(name = "operational_state", description = OPERATIONAL_STATE_DESCRIPTION, required = true)
@SerializedName("operational_state")
@JsonProperty(value = "operational_state", required = true)
public final OperationalState opState;
import org.oransc.enrichment.controllers.producer.ProducerEiTypeInfo;
import org.oransc.enrichment.controllers.producer.ProducerJobInfo;
import org.oransc.enrichment.controllers.producer.ProducerRegistrationInfo;
-import org.oransc.enrichment.controllers.producer.ProducerRegistrationInfo.ProducerEiTypeRegistrationInfo;
import org.oransc.enrichment.controllers.producer.ProducerStatusInfo;
import org.oransc.enrichment.exceptions.ServiceException;
import org.oransc.enrichment.repository.EiJob;
}
@Test
- void createApiDoc() throws FileNotFoundException {
- String url = "/v2/api-docs";
+ void generateApiDoc() throws FileNotFoundException {
+ String url = "/v3/api-docs";
ResponseEntity<String> resp = restClient().getForEntity(url).block();
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
JSONObject jsonObj = new JSONObject(resp.getBody());
- jsonObj.remove("host");
- assertThat(jsonObj.getJSONObject("definitions").remove("Mono«ResponseEntity«object»»")).isNotNull();
- assertThat(jsonObj.getJSONObject("definitions").remove("Void")).isNotNull();
+ assertThat(jsonObj.remove("servers")).isNotNull();
+
String indented = jsonObj.toString(4);
try (PrintStream out = new PrintStream(new FileOutputStream("api/ecs-api.json"))) {
out.print(indented);
assertThat(statusInfo.opState).isEqualTo(expectedOperationalState);
}
- ProducerEiTypeRegistrationInfo producerEiTypeRegistrationInfo(String typeId)
+ ProducerEiTypeInfo producerEiTypeRegistrationInfo(String typeId)
throws JsonMappingException, JsonProcessingException {
- return new ProducerEiTypeRegistrationInfo(jsonSchemaObject(), typeId);
+ return new ProducerEiTypeInfo(jsonSchemaObject());
}
ProducerRegistrationInfo producerEiRegistratioInfoRejecting(String typeId)
throws JsonMappingException, JsonProcessingException, ServiceException {
String url = ProducerConsts.API_ROOT + "/eitypes/" + eiTypeId;
String body = gson.toJson(producerEiTypeRegistrationInfo(eiTypeId));
+
ResponseEntity<String> resp = restClient().putForEntity(url, body).block();
this.eiTypes.getType(eiTypeId);
return resp.getStatusCode();
package org.oransc.enrichment.controller;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import lombok.Getter;
import org.oransc.enrichment.controllers.VoidResponse;
+import org.oransc.enrichment.controllers.consumer.ConsumerConsts;
import org.oransc.enrichment.controllers.consumer.ConsumerEiJobStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RestController;
@RestController("ConsumerSimulatorController")
-@Api(tags = {"A1-EI (enrichment information) callbacks"})
+@Tag(name = ConsumerConsts.CONSUMER_API_CALLBACKS_NAME)
public class ConsumerSimulatorController {
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private TestResults testResults = new TestResults();
public static String getJobStatusUrl(String eiJobId) {
- return "/consumer_simulator/eijobs/" + eiJobId + "/status";
+ return "/example_dataconsumer/eijobs/" + eiJobId + "/status";
}
- @PostMapping(path = "/consumer_simulator/eijobs/{eiJobId}/status", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Callback for EI job status", notes = "")
+ @PostMapping(path = "/example_dataconsumer/eijobs/{eiJobId}/status", produces = MediaType.APPLICATION_JSON_VALUE)
+ @Operation(
+ summary = "Callback for changed EI job status",
+ description = "The primitive is implemented by the data consumer and is invoked when a EI job status has been changed.")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "OK", response = VoidResponse.class)} //
- )
+ @ApiResponse(
+ responseCode = "200",
+ description = "OK", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))) //
+ })
public ResponseEntity<Object> jobStatusCallback( //
@PathVariable("eiJobId") String eiJobId, //
@RequestBody ConsumerEiJobStatus status) {
package org.oransc.enrichment.controller;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import org.oransc.enrichment.controllers.ErrorResponse;
import org.oransc.enrichment.controllers.VoidResponse;
+import org.oransc.enrichment.controllers.producer.ProducerConsts;
import org.oransc.enrichment.controllers.producer.ProducerJobInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RestController;
@RestController("ProducerSimulatorController")
-@Api(tags = {"Data Producer Job Control (example producer)"})
+@Tag(name = ProducerConsts.PRODUCER_API_CALLBACKS_NAME)
public class ProducerSimulatorController {
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private TestResults testResults = new TestResults();
@PostMapping(path = JOB_URL, produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Callback for EI job creation", notes = "")
+ @Operation(
+ summary = "Callback for EI job creation/modification",
+ description = "The call is invoked to activate or to modify a data subscription. The endpoint is provided by the EI producer.")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "OK", response = VoidResponse.class)}//
- )
+ @ApiResponse(
+ responseCode = "200",
+ description = "OK", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))) //
+ })
public ResponseEntity<Object> jobCreatedCallback( //
@RequestBody ProducerJobInfo request) {
try {
}
@DeleteMapping(path = "/producer_simulator/ei_job/{eiJobId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Callback for EI job deletion", notes = "")
+ @Operation(
+ summary = "Callback for EI job deletion",
+ description = "The call is invoked to terminate a data subscription. The endpoint is provided by the EI producer.")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "OK", response = VoidResponse.class)}//
- )
+ @ApiResponse(
+ responseCode = "200",
+ description = "OK", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))) //
+ })
public ResponseEntity<Object> jobDeletedCallback( //
@PathVariable("eiJobId") String eiJobId) {
try {
}
@PostMapping(path = JOB_ERROR_URL, produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Callback for EI job creation, returns error", notes = "", hidden = true)
+ @Operation(summary = "Callback for EI job creation, returns error", description = "", hidden = true)
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "OK", response = VoidResponse.class)}//
- )
+ @ApiResponse(
+ responseCode = "200",
+ description = "OK", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))) //
+ })
public ResponseEntity<Object> jobCreatedCallbackReturnError( //
@RequestBody ProducerJobInfo request) {
logger.info("Job created (returning error) callback {}", request.id);
}
@DeleteMapping(path = JOB_ERROR_URL + "/{eiJobId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Callback for EI job deletion, returns error", notes = "", hidden = true)
+ @Operation(summary = "Callback for EI job deletion, returns error", description = "", hidden = true)
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "OK", response = VoidResponse.class)}//
- )
+ @ApiResponse(
+ responseCode = "200",
+ description = "OK", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))) //
+ })
public ResponseEntity<Object> jobDeletedCallbackReturnError( //
- @RequestBody ProducerJobInfo request) {
- logger.info("Job created (returning error) callback {}", request.id);
+ @PathVariable("eiJobId") String eiJobId) {
+ logger.info("Job created (returning error) callback {}", eiJobId);
this.testResults.noOfRejectedDelete += 1;
return ErrorResponse.create("Producer returns error on delete job", HttpStatus.NOT_FOUND);
}
@GetMapping(path = SUPERVISION_URL, produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Producer supervision", notes = "")
+ @Operation(
+ summary = "Producer supervision",
+ description = "The endpoint is provided by the EI producer and is used for supervision of the producer.")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "OK", response = String.class)}//
- )
+ @ApiResponse(
+ responseCode = "200",
+ description = "The producer is OK", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
+ })
public ResponseEntity<Object> producerSupervision() {
logger.info("Producer supervision");
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping(path = SUPERVISION_ERROR_URL, produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Producer supervision error", notes = "", hidden = true)
+ @Operation(summary = "Producer supervision error", description = "", hidden = true)
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "OK", response = String.class)}//
- )
+ @ApiResponse(
+ responseCode = "200",
+ description = "OK", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
+ })
public ResponseEntity<Object> producerSupervisionError() {
logger.info("Producer supervision error");
return new ResponseEntity<>(HttpStatus.NOT_FOUND);