def validate_environment(): error = '' global JIRA_SEVER, JIRA_USER, JIRA_API_KEY err, JIRA_SEVER = get_ssm_value(key=Parameters.JIRA_HOST.value) error += err err, JIRA_USER = get_ssm_value(key=Parameters.JIRA_USER_ID.value) error += err err, JIRA_API_KEY = get_ssm_value(key=Parameters.JIRA_APP_PASSWORD.value) error += err logger.debug(f'JIRA_SEVER: {JIRA_SEVER} {JIRA_USER} {JIRA_API_KEY}') return error
def validate_environment(): error = '' snow_endpoint = None global SNOW_X_IBM_CLIENT_ID, SNOW_AUTH_USER_NAME, SNOW_AUTH_PASSWORD, SNOW_AUTH_ENDPOINT, SNOW_ATTACHMENT_ENDPOINT err, snow_endpoint = get_ssm_value(key=Parameters.SNOW_HOST.value) error += err err, SNOW_X_IBM_CLIENT_ID = get_ssm_value( key=Parameters.SNOW_CLIENT_ID.value) error += err err, SNOW_AUTH_USER_NAME = get_ssm_value( key=Parameters.SNOW_AUTH_USER_NAME.value) error += err err, SNOW_AUTH_PASSWORD = get_ssm_value( key=Parameters.SNOW_AUTH_PASSWORD.value) error += err SNOW_AUTH_ENDPOINT = f'{snow_endpoint}/authorization/token' SNOW_ATTACHMENT_ENDPOINT = f'{snow_endpoint}/itsm-incident/process/incidents' return error
def validate_environment(): error = '' global JIRA_SEVER, JIRA_USER, JIRA_API_KEY err, JIRA_SEVER = get_ssm_value(key=Parameters.JIRA_HOST.value) error += err err, JIRA_USER = get_ssm_value(key=Parameters.JIRA_USER_ID.value) error += err err, JIRA_API_KEY = get_ssm_value(key=Parameters.JIRA_APP_PASSWORD.value) error += err resp = { "ok": not error, } if error: resp["error"] = error logger.error(error) return 500 if error else 200, resp
def get_api_token(): parameter = None error, parameter = get_ssm_value(key=SSM_API_TOKEN_KEY, with_decryption=True) if error: data = request_access_token() return data['access_token'] else: data = json.loads(parameter) if check_if_token_is_valid(data['expires']) == False: data = request_access_token() return data['access_token']
def validate_environment(): error = '' s3_presigned_url_ttl = None status = 200 error, s3_presigned_url_ttl = get_ssm_value(key=Parameters.S3_PRESIGNED_URL_TTL.value) resp = { "ok": not error, } if error: resp["error"] = error status = 500 logger.error(error) return status, resp, s3_presigned_url_ttl