in functions/source/register/register.py [0:0]
def newrelic_get_schema(access_key):
nerdGraphEndPoint = os.environ['nerdGraphEndPoint']
schema_query = '''
{
__schema
{
types
{
name
inputFields
{
name
}
}
}
}
'''
try:
response = requests.post(nerdGraphEndPoint, headers={'API-Key': access_key}, verify=True, data=schema_query)
logger.info(json.loads(response.text))
temp_types = json.loads(response.text)['data']['__schema']['types']
temp_integration_input = [input['inputFields'] for input in temp_types if input['name'] == 'CloudAwsIntegrationsInput'][0]
newrelic_integration_list = [input['name'] for input in temp_integration_input]
logger.info('NerdGraph AWS available integrations : {}'.format(newrelic_integration_list))
return newrelic_integration_list
except Exception as e:
logger.error(e)