Skip to content

Commit

Permalink
Merge branch '1.0.x' into PIN-5088_edit-create-descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
taglioni-r authored Jul 18, 2024
2 parents ff261c5 + c8d5dca commit d5a65f4
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 3 deletions.
109 changes: 109 additions & 0 deletions src/main/resources/interface-specification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3771,6 +3771,108 @@ paths:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/eservices/{eServiceId}/update:
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
post:
security:
- bearerAuth: [ ]
tags:
- eservices
summary: Update an e-service description
operationId: updateEServiceDescription
parameters:
- name: eServiceId
in: path
description: the eservice id
required: true
schema:
type: string
format: uuid
requestBody:
description: A payload containing the new description
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/EServiceDescriptionSeed"
responses:
"200":
description: EService description updated
headers:
'X-Rate-Limit-Limit':
schema:
type: integer
description: Max allowed requests within time interval
'X-Rate-Limit-Remaining':
schema:
type: integer
description: Remaining requests within time interval
'X-Rate-Limit-Interval':
schema:
type: integer
description: Time interval in milliseconds. Allowed requests will be constantly replenished during the interval. At the end of the interval the max allowed requests will be available
content:
application/json:
schema:
$ref: "#/components/schemas/CreatedResource"
"403":
description: Forbidden
headers:
'X-Rate-Limit-Limit':
schema:
type: integer
description: Max allowed requests within time interval
'X-Rate-Limit-Remaining':
schema:
type: integer
description: Remaining requests within time interval
'X-Rate-Limit-Interval':
schema:
type: integer
description: Time interval in milliseconds. Allowed requests will be constantly replenished during the interval. At the end of the interval the max allowed requests will be available
content:
application/problem+json:
schema:
$ref: "#/components/schemas/Problem"
"404":
description: EService not found
headers:
'X-Rate-Limit-Limit':
schema:
type: integer
description: Max allowed requests within time interval
'X-Rate-Limit-Remaining':
schema:
type: integer
description: Remaining requests within time interval
'X-Rate-Limit-Interval':
schema:
type: integer
description: Time interval in milliseconds. Allowed requests will be constantly replenished during the interval. At the end of the interval the max allowed requests will be available
content:
application/problem+json:
schema:
$ref: "#/components/schemas/Problem"
"400":
description: Bad request
headers:
'X-Rate-Limit-Limit':
schema:
type: integer
description: Max allowed requests within time interval
'X-Rate-Limit-Remaining':
schema:
type: integer
description: Remaining requests within time interval
'X-Rate-Limit-Interval':
schema:
type: integer
description: Time interval in milliseconds. Allowed requests will be constantly replenished during the interval. At the end of the interval the max allowed requests will be available
content:
application/problem+json:
schema:
$ref: "#/components/schemas/Problem"
/export/eservices/{eserviceId}/descriptors/{descriptorId}:
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
Expand Down Expand Up @@ -10666,6 +10768,13 @@ components:
type: string
description:
type: string
EServiceDescriptionSeed:
type: object
properties:
description:
type: string
required:
- description
CatalogEServiceDescriptor:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,7 @@ object EServicesApiMarshallerImpl extends EservicesApiMarshaller with SprayJsonS

override implicit def toEntityMarshallerPresignedUrl: ToEntityMarshaller[PresignedUrl] =
sprayJsonMarshaller[PresignedUrl]

override implicit def fromEntityUnmarshallerEServiceDescriptionSeed: FromEntityUnmarshaller[EServiceDescriptionSeed] =
sprayJsonUnmarshaller[EServiceDescriptionSeed]
}
Original file line number Diff line number Diff line change
Expand Up @@ -1289,4 +1289,26 @@ final case class EServicesApiServiceImpl(
}
}
}

override def updateEServiceDescription(eServiceId: String, eServiceDescriptionSeed: EServiceDescriptionSeed)(implicit
contexts: Seq[(String, String)],
toEntityMarshallerProblem: ToEntityMarshaller[Problem],
toEntityMarshallerCreatedResource: ToEntityMarshaller[CreatedResource]
): Route = {
val result: Future[CreatedResource] = for {
eServiceUuid <- eServiceId.toFutureUUID
eService <- catalogProcessService.updateEServiceDescription(
eServiceUuid,
CatalogProcess.EServiceDescriptionSeed(eServiceDescriptionSeed.description)
)(contexts)
} yield eService.toApi

onComplete(result) {
val headers: List[HttpHeader] = headersFromContext()
handleError(s"Error updating description of eservice with Id: $eServiceId", headers) orElse {
case Success(eservice) =>
updateEServiceDescription200(headers)(eservice)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,14 @@ package object impl extends SprayJsonSupport with DefaultJsonProtocol {
implicit val selfcareProductFormat: RootJsonFormat[SelfcareProduct] = jsonFormat2(SelfcareProduct)
implicit val selfcareInstitutionFormat: RootJsonFormat[SelfcareInstitution] = jsonFormat4(SelfcareInstitution)

implicit val selfcareUserFormat: RootJsonFormat[CompactUser] = jsonFormat3(CompactUser)
implicit val publicKeyFormat: RootJsonFormat[PublicKey] =
implicit val selfcareUserFormat: RootJsonFormat[CompactUser] = jsonFormat3(CompactUser)
implicit val publicKeyFormat: RootJsonFormat[PublicKey] =
jsonFormat5(PublicKey)
implicit val publicKeysFormat: RootJsonFormat[PublicKeys] =
implicit val publicKeysFormat: RootJsonFormat[PublicKeys] =
jsonFormat1(PublicKeys)
implicit val EServiceDescriptionSeedFormat: RootJsonFormat[EServiceDescriptionSeed] = jsonFormat1(
EServiceDescriptionSeed
)

implicit def dependencyFormat: RootJsonFormat[Dependency] =
jsonFormat2(Dependency)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,8 @@ trait CatalogProcessService {
): Future[Unit]

def deleteRiskAnalysis(eServiceId: UUID, riskAnalysisId: UUID)(implicit contexts: Seq[(String, String)]): Future[Unit]

def updateEServiceDescription(eServiceId: UUID, eServiceDescriptionSeed: EServiceDescriptionSeed)(implicit
contexts: Seq[(String, String)]
): Future[EService]
}
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,17 @@ class CatalogProcessServiceImpl(catalogProcessUrl: String, blockingEc: Execution
s"Delete Risk Analysis ${riskAnalysisId.toString} for EService ${eServiceId.toString} from Catalog Process"
)
}

override def updateEServiceDescription(eServiceId: UUID, eServiceDescriptionSeed: EServiceDescriptionSeed)(implicit
contexts: Seq[(String, String)]
): Future[EService] =
withHeaders { (bearerToken, correlationId) =>
val request: ApiRequest[EService] =
api.updateEServiceDescription(
xCorrelationId = correlationId,
eServiceId = eServiceId,
eServiceDescriptionSeed = eServiceDescriptionSeed
)(BearerToken(bearerToken))
invoker.invoke(request, s"Update E-Service ${eServiceId.toString} description from Catalog Process")
}
}

0 comments on commit d5a65f4

Please sign in to comment.