@@ -444,6 +444,52 @@ def createconfig(declaration: ConfigDeclaration, apiversion: str, runfromautosyn
444444 "message" : {"status_code" : status , "message" :
445445 {"code" : status , "content" : f"invalid server authentication profile [{ authServerProfile ['profile' ]} ] in location [{ loc ['uri' ]} ]" }}}
446446
447+ # API Gateway visualization integrations
448+ apiGwVisibilityIntegrations = {}
449+
450+ if loc ['apigateway' ] and loc ['apigateway' ]['visibility' ]:
451+ visibility_integrations = loc ['apigateway' ]['visibility' ]
452+ for i in range (len (visibility_integrations )):
453+ vis = visibility_integrations [i ]
454+
455+ if vis ['enabled' ] == True :
456+ apiGwVisibilityIntegrations [ vis ['type' ] ] = True
457+
458+ if vis ['type' ].lower () == 'moesif' :
459+ # Moesif integration
460+
461+ # Add the rendered Moesif visibility configuration snippet as a config file in the staged configuration - HTTP context
462+ templateName = NcgConfig .config ['templates' ][
463+ 'visibility_root' ] + "/moesif/http.tmpl"
464+ renderedMoesifHTTP = j2_env .get_template (templateName ).render (
465+ vis = vis , loc = loc , ncgconfig = NcgConfig .config )
466+
467+ b64renderedMoesifHTTP = base64 .b64encode (
468+ bytes (renderedMoesifHTTP , 'utf-8' )).decode (
469+ 'utf-8' )
470+ moesifHTTPConfigFile = {'contents' : b64renderedMoesifHTTP ,
471+ 'name' : NcgConfig .config ['nms' ][
472+ 'visibility_dir' ] +
473+ loc ['uri' ] + "-moesif-http.conf" }
474+
475+ auxFiles ['files' ].append (moesifHTTPConfigFile )
476+
477+ # Add the rendered Moesif visibility configuration snippet as a config file in the staged configuration - server context
478+ templateName = NcgConfig .config ['templates' ][
479+ 'visibility_root' ] + "/moesif/server.tmpl"
480+ renderedMoesifServer = j2_env .get_template (templateName ).render (
481+ vis = vis , loc = loc , ncgconfig = NcgConfig .config )
482+
483+ b64renderedMoesifServer = base64 .b64encode (
484+ bytes (renderedMoesifServer , 'utf-8' )).decode (
485+ 'utf-8' )
486+ moesifServerConfigFile = {'contents' : b64renderedMoesifServer ,
487+ 'name' : NcgConfig .config ['nms' ][
488+ 'visibility_dir' ] +
489+ loc ['uri' ] + "-moesif-server.conf" }
490+
491+ auxFiles ['files' ].append (moesifServerConfigFile )
492+
447493 # API Gateway provisioning
448494 if loc ['apigateway' ] and loc ['apigateway' ]['api_gateway' ] and loc ['apigateway' ]['api_gateway' ]['enabled' ] and loc ['apigateway' ]['api_gateway' ]['enabled' ] == True :
449495 openApiAuthProfile = loc ['apigateway' ]['openapi_schema' ]['authentication' ]
@@ -458,7 +504,7 @@ def createconfig(declaration: ConfigDeclaration, apiversion: str, runfromautosyn
458504 # API Gateway configuration template rendering
459505 if apiGatewayConfigDeclaration :
460506 apiGatewaySnippet = j2_env .get_template (NcgConfig .config ['templates' ]['apigwconf' ]).render (
461- declaration = apiGatewayConfigDeclaration , ncgconfig = NcgConfig .config )
507+ declaration = apiGatewayConfigDeclaration , enabledVisibility = apiGwVisibilityIntegrations , ncgconfig = NcgConfig .config )
462508 apiGatewaySnippetb64 = base64 .b64encode (bytes (apiGatewaySnippet , 'utf-8' )).decode ('utf-8' )
463509
464510 newAuxFile = {'contents' : apiGatewaySnippetb64 , 'name' : NcgConfig .config ['nms' ]['apigw_dir' ] +
@@ -485,14 +531,14 @@ def createconfig(declaration: ConfigDeclaration, apiversion: str, runfromautosyn
485531 loc ['apigateway' ]['developer_portal' ]['redocly' ]['uri' ]}
486532 auxFiles ['files' ].append (newAuxFile )
487533
534+ ### / Redocly developer portal - Add optional API Developer portal HTML files
488535 elif loc ['apigateway' ]['developer_portal' ]['type' ].lower () == 'backstage' :
489536 ### Backstage developer portal - Create Kubernetes Backstage manifest
490537 backstageManifest = j2_env .get_template (f"{ NcgConfig .config ['templates' ]['devportal_root' ]} /backstage.tmpl" ).render (
491538 declaration = loc ['apigateway' ]['developer_portal' ]['backstage' ], openAPISchema = v5_1 .MiscUtils .json_to_yaml (openAPISchemaJSON ), ncgconfig = NcgConfig .config )
492539
493540 extraOutputManifests .append (backstageManifest )
494-
495- ### / Backstage developer portal - Create Kubernetes Backstage manifest
541+ ### / Backstage developer portal - Create Kubernetes Backstage manifest
496542
497543 # Check rate limit profile name validity
498544 if loc ['rate_limit' ] is not None :
0 commit comments