From daab14bd058de198c80b71d63e108fd788b7f5ee Mon Sep 17 00:00:00 2001 From: Jozsef Csongvai Date: Mon, 26 Jul 2021 12:00:59 -0400 Subject: Revert "Renaming Files having BluePrint to have Blueprint" The renaming in CCSDK-3098 caused breaking changes to the grpc api and compile issues for kotlin scripts. Issue-ID: CCSDK-3385 Change-Id: I0d745cb858371678eabcb2284671c1fd76a1ab6d Signed-off-by: Jozsef Csongvai --- ms/artifact-manager/manager/servicer.py | 60 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'ms/artifact-manager/manager/servicer.py') diff --git a/ms/artifact-manager/manager/servicer.py b/ms/artifact-manager/manager/servicer.py index fd05fe0cc..be740b0e3 100644 --- a/ms/artifact-manager/manager/servicer.py +++ b/ms/artifact-manager/manager/servicer.py @@ -23,13 +23,13 @@ from manager.configuration import get_logger from manager.errors import ArtifactManagerError, InvalidRequestError from manager.utils import Repository, RepositoryStrategy from onaplogging.mdcContext import MDC -from proto.BlueprintManagement_pb2 import ( - BlueprintDownloadInput, - BlueprintManagementOutput, - BlueprintRemoveInput, - BlueprintUploadInput, +from proto.BluePrintManagement_pb2 import ( + BluePrintDownloadInput, + BluePrintManagementOutput, + BluePrintRemoveInput, + BluePrintUploadInput, ) -from proto.BlueprintManagement_pb2_grpc import BlueprintManagementServiceServicer +from proto.BluePrintManagement_pb2_grpc import BluePrintManagementServiceServicer MDC_DATETIME_FORMAT = r"%Y-%m-%dT%H:%M:%S.%f%z" COMMON_HEADER_DATETIME_FORMAT = r"%Y-%m-%dT%H:%M:%S.%fZ" @@ -47,13 +47,13 @@ def fill_common_header(func): @wraps(func) def _decorator( servicer: "ArtifactManagerServicer", - request: Union[BlueprintDownloadInput, BlueprintRemoveInput, BlueprintUploadInput], + request: Union[BluePrintDownloadInput, BluePrintRemoveInput, BluePrintUploadInput], context: ServicerContext, - ) -> BlueprintManagementOutput: + ) -> BluePrintManagementOutput: if not all([request.actionIdentifiers.blueprintName, request.actionIdentifiers.blueprintVersion]): - raise InvalidRequestError("Request has to have set both Blueprint name and version") - output: BlueprintManagementOutput = func(servicer, request, context) + raise InvalidRequestError("Request has to have set both BluePrint name and version") + output: BluePrintManagementOutput = func(servicer, request, context) # Set same values for every handler output.commonHeader.CopyFrom(request.commonHeader) output.commonHeader.timestamp = datetime.utcnow().strftime(COMMON_HEADER_DATETIME_FORMAT) @@ -72,11 +72,11 @@ def translate_exception_to_response(func): @wraps(func) def _handler( servicer: "ArtifactManagerServicer", - request: Union[BlueprintDownloadInput, BlueprintRemoveInput, BlueprintUploadInput], + request: Union[BluePrintDownloadInput, BluePrintRemoveInput, BluePrintUploadInput], context: ServicerContext, - ) -> BlueprintManagementOutput: + ) -> BluePrintManagementOutput: try: - output: BlueprintManagementOutput = func(servicer, request, context) + output: BluePrintManagementOutput = func(servicer, request, context) output.status.code = 200 output.status.message = "success" except ArtifactManagerError as error: @@ -84,7 +84,7 @@ def translate_exception_to_response(func): # Every ArtifactManagerError based exception has status_code paramenter # which has to be set in output. Use also exception's message to # set errorMessage of the output. - output: BlueprintManagementOutput = BlueprintManagementOutput() + output: BluePrintManagementOutput = BluePrintManagementOutput() output.status.code = error.status_code output.status.message = "failure" output.status.errorMessage = str(error.message) @@ -112,9 +112,9 @@ def prepare_logging_context(func): @wraps(func) def _decorator( servicer: "ArtifactManagerServicer", - request: Union[BlueprintDownloadInput, BlueprintRemoveInput, BlueprintUploadInput], + request: Union[BluePrintDownloadInput, BluePrintRemoveInput, BluePrintUploadInput], context: ServicerContext, - ) -> BlueprintManagementOutput: + ) -> BluePrintManagementOutput: MDC.put("RequestID", request.commonHeader.requestId) MDC.put("InvocationID", request.commonHeader.subRequestId) MDC.put("ServiceName", servicer.__class__.__name__) @@ -129,14 +129,14 @@ def prepare_logging_context(func): MDC.put("TargetServiceName", func.__name__) MDC.put("Server", socket.getfqdn()) - output: BlueprintManagementOutput = func(servicer, request, context) + output: BluePrintManagementOutput = func(servicer, request, context) MDC.clear() return output return _decorator -class ArtifactManagerServicer(BlueprintManagementServiceServicer): +class ArtifactManagerServicer(BluePrintManagementServiceServicer): """ArtifactManagerServer class. Implements methods defined in proto files to manage artifacts repository. @@ -169,15 +169,15 @@ class ArtifactManagerServicer(BlueprintManagementServiceServicer): @prepare_logging_context @translate_exception_to_response @fill_common_header - def downloadBlueprint(self, request: BlueprintDownloadInput, context: ServicerContext) -> BlueprintManagementOutput: + def downloadBlueprint(self, request: BluePrintDownloadInput, context: ServicerContext) -> BluePrintManagementOutput: """Download blueprint file request method. Currently it only logs when is called and all base class method. - :param request: BlueprintDownloadInput + :param request: BluePrintDownloadInput :param context: ServicerContext - :return: BlueprintManagementOutput + :return: BluePrintManagementOutput """ - output: BlueprintManagementOutput = BlueprintManagementOutput() + output: BluePrintManagementOutput = BluePrintManagementOutput() output.fileChunk.chunk = self.repository.download_blueprint( request.actionIdentifiers.blueprintName, request.actionIdentifiers.blueprintVersion ) @@ -193,13 +193,13 @@ class ArtifactManagerServicer(BlueprintManagementServiceServicer): @prepare_logging_context @translate_exception_to_response @fill_common_header - def uploadBlueprint(self, request: BlueprintUploadInput, context: ServicerContext) -> BlueprintManagementOutput: + def uploadBlueprint(self, request: BluePrintUploadInput, context: ServicerContext) -> BluePrintManagementOutput: """Upload blueprint file request method. Currently it only logs when is called and all base class method. - :param request: BlueprintUploadInput + :param request: BluePrintUploadInput :param context: ServicerContext - :return: BlueprintManagementOutput + :return: BluePrintManagementOutput """ self.repository.upload_blueprint( request.fileChunk.chunk, request.actionIdentifiers.blueprintName, request.actionIdentifiers.blueprintVersion @@ -211,18 +211,18 @@ class ArtifactManagerServicer(BlueprintManagementServiceServicer): ), extra={"mdc": MDC.result()}, ) - return BlueprintManagementOutput() + return BluePrintManagementOutput() @prepare_logging_context @translate_exception_to_response @fill_common_header - def removeBlueprint(self, request: BlueprintRemoveInput, context: ServicerContext) -> BlueprintManagementOutput: + def removeBlueprint(self, request: BluePrintRemoveInput, context: ServicerContext) -> BluePrintManagementOutput: """Remove blueprint file request method. Currently it only logs when is called and all base class method. - :param request: BlueprintRemoveInput + :param request: BluePrintRemoveInput :param context: ServicerContext - :return: BlueprintManagementOutput + :return: BluePrintManagementOutput """ self.repository.remove_blueprint( request.actionIdentifiers.blueprintName, request.actionIdentifiers.blueprintVersion @@ -234,4 +234,4 @@ class ArtifactManagerServicer(BlueprintManagementServiceServicer): ), extra={"mdc": MDC.result()}, ) - return BlueprintManagementOutput() + return BluePrintManagementOutput() -- cgit 1.2.3-korg