Example #1
0
def retrieve_license_key(gql):
    try:
        return gql.get_license_key()
    except Exception:
        raise click.BadParameterError(
            "Could not retrieve license key from New Relic. Check that your New Relic "
            "Account ID is valid and try again.",
            param="nr_account_id",
        )
Example #2
0
def validate_gql_credentials(nr_account_id, nr_api_key, nr_region):
    try:
        return NewRelicGQL(nr_account_id, nr_api_key, nr_region)
    except requests.exceptions.HTTPError:
        raise click.BadParameterError(
            "Could not authenticate with New Relic. Check that your New Relic API Key "
            "is valid and try again.",
            param="nr_api_key",
        )